home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / interp / perl5.005.tar.gz / perl5.005.tar / perl5.005 / Configure < prev    next >
Text File  |  1998-07-15  |  263KB  |  12,080 lines

  1. #! /bin/sh
  2. #
  3. # If these # comments don't work, trim them. Don't worry about any other
  4. # shell scripts, Configure will trim # comments from them for you.
  5. #
  6. # (If you are trying to port this package to a machine without sh,
  7. # I would suggest you have a look at the prototypical config_h.SH file
  8. # and edit it to reflect your system. Some packages may include samples
  9. # of config.h for certain machines, so you might look for one of those.)
  10. #
  11. # Yes, you may rip this off to use in other distribution packages. This
  12. # script belongs to the public domain and cannot be copyrighted.
  13. #
  14. # (Note: this Configure script was generated automatically. Rather than
  15. # working with this copy of Configure, you may wish to get metaconfig.
  16. # The dist-3.0 package (which contains metaconfig) was posted in
  17. # comp.sources.misc and is available on CPAN under authors/id/RAM so
  18. # you may fetch it yourself from your nearest archive site.)
  19. #
  20.  
  21. # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
  22. #
  23. # Generated on Tue Jul  7 10:10:21 EDT 1998 [metaconfig 3.0 PL70]
  24. # (with additional metaconfig patches by doughera@lafayette.edu)
  25.  
  26. cat >/tmp/c1$$ <<EOF
  27. ARGGGHHHH!!!!!
  28.  
  29. SCO csh still thinks true is false.  Write to SCO today and tell them that next
  30. year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
  31.  
  32. (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
  33. we'd have to do is go in and swap the && and || tokens, wherever they are.)
  34.  
  35. [End of diatribe. We now return you to your regularly scheduled programming...]
  36. EOF
  37. cat >/tmp/c2$$ <<EOF
  38.  
  39. OOPS!  You naughty creature!  You didn't run Configure with sh!
  40. I will attempt to remedy the situation by running sh for you...
  41. EOF
  42.  
  43. true || cat /tmp/c1$$ /tmp/c2$$
  44. true || exec sh $0 $argv:q
  45.  
  46. (exit $?0) || cat /tmp/c2$$
  47. (exit $?0) || exec sh $0 $argv:q
  48. rm -f /tmp/c1$$ /tmp/c2$$
  49.  
  50. : compute my invocation name
  51. me=$0
  52. case "$0" in
  53. */*)
  54.     me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
  55.     test "$me" || me=$0
  56.     ;;
  57. esac
  58.  
  59. : the newline for tr
  60. if test X"$trnl" = X; then
  61.     case "`echo foo|tr '\n' x 2>/dev/null`" in
  62.     foox)
  63.         trnl='\n'
  64.         ;;
  65.     esac
  66. fi
  67. if test X"$trnl" = X; then
  68.     case "`echo foo|tr '\012' x 2>/dev/null`" in
  69.     foox)
  70.         trnl='\012'
  71.         ;;
  72.     esac
  73. fi
  74. if test -n "$DJGPP"; then
  75.     trnl='\012'
  76. fi
  77. if test X"$trnl" = X; then
  78.     cat <<EOM >&2
  79.  
  80. $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
  81.  
  82. EOM
  83.     exit 1
  84. fi
  85.  
  86. : Proper separator for the PATH environment variable
  87. p_=:
  88. : On OS/2 this directory should exist if this is not floppy only system :-]
  89. if test -d c:/. ; then
  90.     if test -n "$OS2_SHELL"; then
  91.         p_=\;
  92.         PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
  93.         OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
  94.     elif test -n "$DJGPP"; then
  95.         p_=\;
  96.     fi
  97. fi
  98.  
  99. : Proper PATH setting
  100. paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
  101. paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
  102. paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
  103. paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
  104. paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
  105. paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
  106. paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
  107. paths="$paths /sbin /usr/sbin /usr/libexec"
  108.  
  109. for p in $paths
  110. do
  111.     case "$p_$PATH$p_" in
  112.     *$p_$p$p_*) ;;
  113.     *) test -d $p && PATH=$PATH$p_$p ;;
  114.     esac
  115. done
  116.  
  117. PATH=.$p_$PATH
  118. export PATH
  119.  
  120. : shall we be using ksh?
  121. inksh=''
  122. needksh=''
  123. avoidksh=''
  124. newsh=/bin/ksh
  125. changesh=''
  126. if (PATH=.; alias -x) >/dev/null 2>&1; then
  127.         inksh=true
  128. fi
  129. if test -f /hp-ux -a -f /bin/ksh; then
  130.     needksh='to avoid sh bug in "here document" expansion'
  131. fi
  132. if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
  133.     if test X`/usr/bin/uname -v` = X4; then
  134.         avoidksh="to avoid AIX 4's /bin/sh"
  135.         newsh=/usr/bin/bsh
  136.     fi
  137. fi
  138. case "$inksh/$needksh" in
  139. /[a-z]*)
  140.         ENV=''
  141.         changesh=true
  142.         reason="$needksh"
  143.     ;;
  144. esac
  145. case "$inksh/$avoidksh" in
  146. true/[a-z]*)
  147.     changesh=true
  148.     reason="$avoidksh"
  149.     ;;
  150. esac
  151. case "$inksh/$needksh-$avoidksh-" in
  152. true/--)
  153.         cat <<EOM
  154. (I see you are using the Korn shell.  Some ksh's blow up on $me,
  155. mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
  156. EOM
  157.     ;;
  158. esac
  159. case "$changesh" in
  160. true)
  161.     echo "(Feeding myself to $newsh $reason.)"
  162.     case "$0" in
  163.     Configure|*/Configure) exec $newsh $0 "$@";;
  164.     *) exec $newsh Configure "$@";;
  165.     esac
  166.     ;;
  167. esac
  168.  
  169. : if needed set CDPATH to a harmless value that is not chatty
  170. : avoid bash 2.02 problems with empty CDPATH.
  171. case "$CDPATH" in
  172. '')    ;;
  173. *)    case "$SHELL" in
  174.     *bash*)    CDPATH='.' ;;
  175.     *)        CDPATH='' ;;
  176.     esac
  177.     ;;
  178. esac
  179. : Configure runs within the UU subdirectory
  180. test -d UU || mkdir UU
  181. cd UU && rm -f ./*
  182.  
  183. dynamic_ext=''
  184. extensions=''
  185. known_extensions=''
  186. nonxs_ext=''
  187. static_ext=''
  188. useopcode=''
  189. useposix=''
  190. d_bsd=''
  191. d_eunice=''
  192. d_xenix=''
  193. eunicefix=''
  194. Mcc=''
  195. ar=''
  196. awk=''
  197. bash=''
  198. bison=''
  199. byacc=''
  200. cat=''
  201. chgrp=''
  202. chmod=''
  203. chown=''
  204. comm=''
  205. compress=''
  206. cp=''
  207. cpio=''
  208. cpp=''
  209. csh=''
  210. date=''
  211. echo=''
  212. egrep=''
  213. emacs=''
  214. expr=''
  215. find=''
  216. flex=''
  217. grep=''
  218. gzip=''
  219. inews=''
  220. ksh=''
  221. less=''
  222. line=''
  223. lint=''
  224. ln=''
  225. lp=''
  226. lpr=''
  227. ls=''
  228. mail=''
  229. mailx=''
  230. make=''
  231. mkdir=''
  232. more=''
  233. mv=''
  234. nm=''
  235. nroff=''
  236. perl=''
  237. pg=''
  238. pmake=''
  239. pr=''
  240. rm=''
  241. rmail=''
  242. sed=''
  243. sendmail=''
  244. shar=''
  245. sleep=''
  246. smail=''
  247. sort=''
  248. submit=''
  249. tail=''
  250. tar=''
  251. tbl=''
  252. tee=''
  253. test=''
  254. touch=''
  255. tr=''
  256. troff=''
  257. uname=''
  258. uniq=''
  259. uuname=''
  260. vi=''
  261. zcat=''
  262. zip=''
  263. full_sed=''
  264. libswanted=''
  265. hint=''
  266. myuname=''
  267. osname=''
  268. osvers=''
  269. Author=''
  270. Date=''
  271. Header=''
  272. Id=''
  273. Locker=''
  274. Log=''
  275. RCSfile=''
  276. Revision=''
  277. Source=''
  278. State=''
  279. _a=''
  280. _exe=''
  281. _o=''
  282. archobjs=''
  283. exe_ext=''
  284. firstmakefile=''
  285. lib_ext=''
  286. obj_ext=''
  287. path_sep=''
  288. afs=''
  289. alignbytes=''
  290. ansi2knr=''
  291. archlib=''
  292. archlibexp=''
  293. d_archlib=''
  294. installarchlib=''
  295. archname=''
  296. myarchname=''
  297. baserev=''
  298. bin=''
  299. binexp=''
  300. installbin=''
  301. byteorder=''
  302. cc=''
  303. gccversion=''
  304. ccflags=''
  305. cppflags=''
  306. ldflags=''
  307. lkflags=''
  308. locincpth=''
  309. optimize=''
  310. cf_email=''
  311. cf_by=''
  312. cf_time=''
  313. contains=''
  314. cpp_stuff=''
  315. cpplast=''
  316. cppminus=''
  317. cpprun=''
  318. cppstdin=''
  319. d_access=''
  320. d_alarm=''
  321. d_attribut=''
  322. d_bcmp=''
  323. d_bcopy=''
  324. d_bzero=''
  325. d_casti32=''
  326. castflags=''
  327. d_castneg=''
  328. d_chown=''
  329. d_chroot=''
  330. d_chsize=''
  331. d_closedir=''
  332. d_void_closedir=''
  333. d_const=''
  334. cryptlib=''
  335. d_crypt=''
  336. d_csh=''
  337. full_csh=''
  338. d_cuserid=''
  339. d_dbl_dig=''
  340. d_difftime=''
  341. d_dlerror=''
  342. d_dlopen=''
  343. d_dlsymun=''
  344. d_dosuid=''
  345. d_suidsafe=''
  346. d_dup2=''
  347. d_endhent=''
  348. d_endnent=''
  349. d_endpent=''
  350. d_endsent=''
  351. d_fchmod=''
  352. d_fchown=''
  353. d_fcntl=''
  354. d_fd_macros=''
  355. d_fd_set=''
  356. d_fds_bits=''
  357. d_fgetpos=''
  358. d_flexfnam=''
  359. d_flock=''
  360. d_fork=''
  361. d_fsetpos=''
  362. d_ftime=''
  363. d_gettimeod=''
  364. d_Gconvert=''
  365. d_getgrps=''
  366. d_gethbyaddr=''
  367. d_gethbyname=''
  368. d_gethent=''
  369. aphostname=''
  370. d_gethname=''
  371. d_phostname=''
  372. d_uname=''
  373. d_gethostprotos=''
  374. d_getlogin=''
  375. d_getnbyaddr=''
  376. d_getnbyname=''
  377. d_getnent=''
  378. d_getnetprotos=''
  379. d_getpent=''
  380. d_getpgid=''
  381. d_getpgrp2=''
  382. d_bsdgetpgrp=''
  383. d_getpgrp=''
  384. d_getppid=''
  385. d_getprior=''
  386. d_getpbyname=''
  387. d_getpbynumber=''
  388. d_getprotoprotos=''
  389. d_getsent=''
  390. d_getservprotos=''
  391. d_getsbyname=''
  392. d_getsbyport=''
  393. d_gnulibc=''
  394. i_arpainet=''
  395. d_htonl=''
  396. d_inetaton=''
  397. d_isascii=''
  398. d_killpg=''
  399. d_lchown=''
  400. d_link=''
  401. d_locconv=''
  402. d_lockf=''
  403. d_longdbl=''
  404. longdblsize=''
  405. d_longlong=''
  406. longlongsize=''
  407. d_lstat=''
  408. d_mblen=''
  409. d_mbstowcs=''
  410. d_mbtowc=''
  411. d_memcmp=''
  412. d_memcpy=''
  413. d_memmove=''
  414. d_memset=''
  415. d_mkdir=''
  416. d_mkfifo=''
  417. d_mktime=''
  418. d_msg=''
  419. d_msgctl=''
  420. d_msgget=''
  421. d_msgrcv=''
  422. d_msgsnd=''
  423. d_nice=''
  424. d_open3=''
  425. d_fpathconf=''
  426. d_pathconf=''
  427. d_pause=''
  428. d_pipe=''
  429. d_poll=''
  430. d_portable=''
  431. d_pthread_yield=''
  432. d_sched_yield=''
  433. d_pthreads_created_joinable=''
  434. d_readdir=''
  435. d_rewinddir=''
  436. d_seekdir=''
  437. d_telldir=''
  438. d_readlink=''
  439. d_rename=''
  440. d_rmdir=''
  441. d_safebcpy=''
  442. d_safemcpy=''
  443. d_sanemcmp=''
  444. d_select=''
  445. d_sem=''
  446. d_semctl=''
  447. d_semget=''
  448. d_semop=''
  449. d_setegid=''
  450. d_seteuid=''
  451. d_setgrps=''
  452. d_sethent=''
  453. d_setlinebuf=''
  454. d_setlocale=''
  455. d_setnent=''
  456. d_setpent=''
  457. d_setpgid=''
  458. d_setpgrp2=''
  459. d_bsdsetpgrp=''
  460. d_setpgrp=''
  461. d_setprior=''
  462. d_setregid=''
  463. d_setresgid=''
  464. d_setresuid=''
  465. d_setreuid=''
  466. d_setrgid=''
  467. d_setruid=''
  468. d_setsent=''
  469. d_setsid=''
  470. d_setvbuf=''
  471. d_sfio=''
  472. usesfio=''
  473. d_shm=''
  474. d_shmat=''
  475. d_shmatprototype=''
  476. shmattype=''
  477. d_shmctl=''
  478. d_shmdt=''
  479. d_shmget=''
  480. d_sigaction=''
  481. d_sigsetjmp=''
  482. d_oldsock=''
  483. d_socket=''
  484. d_sockpair=''
  485. sockethdr=''
  486. socketlib=''
  487. d_statblks=''
  488. d_stdio_cnt_lval=''
  489. d_stdio_ptr_lval=''
  490. d_stdiobase=''
  491. d_stdstdio=''
  492. stdio_base=''
  493. stdio_bufsiz=''
  494. stdio_cnt=''
  495. stdio_filbuf=''
  496. stdio_ptr=''
  497. d_index=''
  498. d_strchr=''
  499. d_strcoll=''
  500. d_strctcpy=''
  501. d_strerrm=''
  502. d_strerror=''
  503. d_sysernlst=''
  504. d_syserrlst=''
  505. d_strtod=''
  506. d_strtol=''
  507. d_strtoul=''
  508. d_strxfrm=''
  509. d_symlink=''
  510. d_syscall=''
  511. d_sysconf=''
  512. d_system=''
  513. d_tcgetpgrp=''
  514. d_tcsetpgrp=''
  515. d_time=''
  516. timetype=''
  517. clocktype=''
  518. d_times=''
  519. d_truncate=''
  520. d_tzname=''
  521. d_umask=''
  522. d_semctl_semid_ds=''
  523. d_semctl_semun=''
  524. d_union_semun=''
  525. d_vfork=''
  526. usevfork=''
  527. d_voidsig=''
  528. signal_t=''
  529. d_volatile=''
  530. d_charvspr=''
  531. d_vprintf=''
  532. d_wait4=''
  533. d_waitpid=''
  534. d_wcstombs=''
  535. d_wctomb=''
  536. dlext=''
  537. cccdlflags=''
  538. ccdlflags=''
  539. dlsrc=''
  540. ld=''
  541. lddlflags=''
  542. usedl=''
  543. doublesize=''
  544. fpostype=''
  545. gidtype=''
  546. groupstype=''
  547. h_fcntl=''
  548. h_sysfile=''
  549. db_hashtype=''
  550. db_prefixtype=''
  551. i_db=''
  552. i_dbm=''
  553. i_rpcsvcdbm=''
  554. d_dirnamlen=''
  555. direntrytype=''
  556. i_dirent=''
  557. i_dld=''
  558. i_dlfcn=''
  559. i_fcntl=''
  560. i_float=''
  561. i_gdbm=''
  562. d_grpasswd=''
  563. d_setgrent=''
  564. d_getgrent=''
  565. d_endgrent=''
  566. i_grp=''
  567. i_limits=''
  568. i_locale=''
  569. i_malloc=''
  570. i_math=''
  571. i_memory=''
  572. i_ndbm=''
  573. i_netdb=''
  574. i_neterrno=''
  575. i_niin=''
  576. i_sysin=''
  577. d_pwage=''
  578. d_pwchange=''
  579. d_pwclass=''
  580. d_pwcomment=''
  581. d_pwexpire=''
  582. d_pwgecos=''
  583. d_pwpasswd=''
  584. d_pwquota=''
  585. d_setpwent=''
  586. d_getpwent=''
  587. d_endpwent=''
  588. i_pwd=''
  589. i_sfio=''
  590. i_stddef=''
  591. i_stdlib=''
  592. i_string=''
  593. strings=''
  594. i_sysdir=''
  595. i_sysfile=''
  596. d_voidtty=''
  597. i_bsdioctl=''
  598. i_sysfilio=''
  599. i_sysioctl=''
  600. i_syssockio=''
  601. i_sysndir=''
  602. i_sysparam=''
  603. i_sysresrc=''
  604. i_sysselct=''
  605. i_sysstat=''
  606. i_systimes=''
  607. i_systypes=''
  608. i_sysun=''
  609. i_syswait=''
  610. i_sgtty=''
  611. i_termio=''
  612. i_termios=''
  613. i_systime=''
  614. i_systimek=''
  615. i_time=''
  616. timeincl=''
  617. i_unistd=''
  618. i_utime=''
  619. i_values=''
  620. i_stdarg=''
  621. i_varargs=''
  622. i_varhdr=''
  623. i_vfork=''
  624. intsize=''
  625. longsize=''
  626. shortsize=''
  627. libc=''
  628. libperl=''
  629. shrpenv=''
  630. useshrplib=''
  631. glibpth=''
  632. libpth=''
  633. loclibpth=''
  634. plibpth=''
  635. xlibpth=''
  636. libs=''
  637. lns=''
  638. lseektype=''
  639. make_set_make=''
  640. d_mymalloc=''
  641. freetype=''
  642. mallocobj=''
  643. mallocsrc=''
  644. malloctype=''
  645. usemymalloc=''
  646. installman1dir=''
  647. man1dir=''
  648. man1direxp=''
  649. man1ext=''
  650. installman3dir=''
  651. man3dir=''
  652. man3direxp=''
  653. man3ext=''
  654. huge=''
  655. large=''
  656. medium=''
  657. models=''
  658. small=''
  659. split=''
  660. modetype=''
  661. mydomain=''
  662. myhostname=''
  663. phostname=''
  664. c=''
  665. n=''
  666. d_eofnblk=''
  667. eagain=''
  668. o_nonblock=''
  669. rd_nodata=''
  670. netdb_hlen_type=''
  671. netdb_host_type=''
  672. netdb_name_type=''
  673. netdb_net_type=''
  674. groupcat=''
  675. hostcat=''
  676. passcat=''
  677. orderlib=''
  678. ranlib=''
  679. package=''
  680. spackage=''
  681. pager=''
  682. apiversion=''
  683. patchlevel=''
  684. subversion=''
  685. version=''
  686. perladmin=''
  687. perlpath=''
  688. pidtype=''
  689. prefix=''
  690. prefixexp=''
  691. installprivlib=''
  692. privlib=''
  693. privlibexp=''
  694. prototype=''
  695. ptrsize=''
  696. randbits=''
  697. installscript=''
  698. scriptdir=''
  699. scriptdirexp=''
  700. selecttype=''
  701. sh=''
  702. sig_name=''
  703. sig_name_init=''
  704. sig_num=''
  705. installsitearch=''
  706. sitearch=''
  707. sitearchexp=''
  708. installsitelib=''
  709. sitelib=''
  710. sitelibexp=''
  711. sizetype=''
  712. so=''
  713. sharpbang=''
  714. shsharp=''
  715. spitshell=''
  716. src=''
  717. ssizetype=''
  718. startperl=''
  719. startsh=''
  720. stdchar=''
  721. sysman=''
  722. uidtype=''
  723. nm_opt=''
  724. nm_so_opt=''
  725. runnm=''
  726. usenm=''
  727. useperlio=''
  728. d_oldpthreads=''
  729. usethreads=''
  730. incpath=''
  731. mips=''
  732. mips_type=''
  733. usrinc=''
  734. defvoidused=''
  735. voidflags=''
  736. ebcdic=''
  737. CONFIG=''
  738.  
  739. define='define'
  740. undef='undef'
  741. smallmach='pdp11 i8086 z8000 i80286 iAPX286'
  742. rmlist=''
  743.  
  744. : We must find out about Eunice early
  745. eunicefix=':'
  746. if test -f /etc/unixtovms; then
  747.     eunicefix=/etc/unixtovms
  748. fi
  749. if test -f /etc/unixtovms.exe; then
  750.     eunicefix=/etc/unixtovms.exe
  751. fi
  752.  
  753. : list of known cpp symbols, sorted alphabetically
  754. al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
  755. al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
  756. al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
  757. al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
  758. al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
  759. al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
  760. al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
  761. al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
  762. al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
  763. al="$al VMS Xenix286"
  764. al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI _POWER"
  765. al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
  766. al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
  767. al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
  768. al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
  769. al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
  770. al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
  771. al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
  772. al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
  773. al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
  774. al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
  775. al="$al __SVR4_2__ __UMAXV__"
  776. al="$al ____386BSD____ __alpha __alpha__ __amiga"
  777. al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
  778. al="$al __host_mips__"
  779. al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
  780. al="$al __hp9000s500 __hp9000s700 __hp9000s800"
  781. al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
  782. al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
  783. al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
  784. al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
  785. al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
  786. al="$al __mc88100 __mc88100__ __mips __mips__"
  787. al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
  788. al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
  789. al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
  790. al="$al _host_mips _mips _unix"
  791. al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
  792. al="$al apollo ardent att386 att3b"
  793. al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
  794. al="$al cadmus clipper concurrent convex cray ctix"
  795. al="$al dmert encore gcos gcx gimpel gould"
  796. al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
  797. al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
  798. al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
  799. al="$al i186 i286 i386 i486 i8086"
  800. al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
  801. al="$al ksr1 linux luna luna88k m68k m88100 m88k"
  802. al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
  803. al="$al mc68040 mc68060 mc68k mc68k32 mc700"
  804. al="$al mc88000 mc88100 merlin mert mips mvs n16"
  805. al="$al ncl_el ncl_mr"
  806. al="$al news1500 news1700 news1800 news1900 news3700"
  807. al="$al news700 news800 news900 ns16000 ns32000"
  808. al="$al ns32016 ns32332 ns32k nsc32000 os osf"
  809. al="$al parisc pc532 pdp11 plexus posix pyr"
  810. al="$al riscix riscos scs sequent sgi sinix sony sony_news"
  811. al="$al sonyrisc sparc sparclite spectrum stardent stratos"
  812. al="$al sun sun3 sun386 svr4 sysV68 sysV88"
  813. al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
  814. al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
  815. al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
  816. al="$al xenix z8000"
  817.  
  818. i_whoami=''
  819. : change the next line if compiling for Xenix/286 on Xenix/386
  820. xlibpth='/usr/lib/386 /lib/386'
  821.  
  822. : Possible local library directories to search.
  823. loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
  824. loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
  825.  
  826. : general looking path for locating libraries
  827. glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
  828. glibpth="$glibpth /lib /usr/lib $xlibpth"
  829. glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
  830. glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
  831.  
  832. : Private path used by Configure to find libraries.  Its value
  833. : is prepended to libpth. This variable takes care of special
  834. : machines, like the mips.  Usually, it should be empty.
  835. plibpth=''
  836.  
  837. : default library list
  838. libswanted=''
  839. : Possible local include directories to search.
  840. : Set locincpth to "" in a hint file to defeat local include searches.
  841. locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
  842. locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
  843. :
  844. : no include file wanted by default
  845. inclwanted=''
  846.  
  847. : Trailing extension.  Override this in a hint file, if needed.
  848. _exe=''
  849. : Extra object files, if any, needed on this platform.
  850. archobjs=''
  851. groupstype=''
  852. : full support for void wanted by default
  853. defvoidused=15
  854.  
  855. : set useposix=false in your hint file to disable the POSIX extension.
  856. useposix=true
  857. : set useopcode=false in your hint file to disable the Opcode extension.
  858. useopcode=true
  859. : set usethreads on the Configure command line to enable threads.
  860. : List of libraries we want.
  861. : If anyone needs -lnet, put it in a hint file.
  862. libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
  863. libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
  864. libswanted="$libswanted ucb bsd BSD PW x"
  865. : We probably want to search /usr/shlib before most other libraries.
  866. : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
  867. glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
  868. glibpth="/usr/shlib $glibpth"
  869. : Do not use vfork unless overridden by a hint file.
  870. usevfork=false
  871.  
  872. : Find the basic shell for Bourne shell scripts
  873. case "$sh" in
  874. '')
  875.     case "$SYSTYPE" in
  876.     *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
  877.     *) xxx='/bin/sh';;
  878.     esac
  879.     if test -f "$xxx"; then
  880.         sh="$xxx"
  881.     else
  882.         : Build up a list and do a single loop so we can 'break' out.
  883.         pth=`echo $PATH | sed -e "s/$p_/ /g"`
  884.         for xxx in sh bash ksh pdksh ash; do
  885.             for p in $pth; do
  886.                 try="$try ${p}/${xxx}"
  887.             done
  888.         done
  889.         for xxx in $try; do
  890.             if test -f "$xxx"; then
  891.                 sh="$xxx";
  892.                 break
  893.             elif test -f "$xxx.exe"; then
  894.                 sh="$xxx";
  895.                 break
  896.             fi
  897.         done
  898.     fi
  899.     ;;
  900. esac
  901.  
  902. case "$sh" in
  903. '')    cat <<EOM >&2
  904. $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
  905.  
  906. Usually it's in /bin/sh.  How did you even get this far?
  907. Please contact me (Andy Dougherty) at doughera@lafayette.edu and 
  908. we'll try to straighten this all out.
  909. EOM
  910.     exit 1
  911.     ;;
  912. esac
  913.  
  914. : see if sh knows # comments
  915. if `$sh -c '#' >/dev/null 2>&1`; then
  916.     shsharp=true
  917.     spitshell=cat
  918.     xcat=/bin/cat
  919.     test -f $xcat || xcat=/usr/bin/cat
  920.     echo "#!$xcat" >try
  921.     $eunicefix try
  922.     chmod +x try
  923.     ./try > today
  924.     if test -s today; then
  925.         sharpbang='#!'
  926.     else
  927.         echo "#! $xcat" > try
  928.         $eunicefix try
  929.         chmod +x try
  930.         ./try > today
  931.         if test -s today; then
  932.             sharpbang='#! '
  933.         else
  934.             sharpbang=': use '
  935.         fi
  936.     fi
  937. else
  938.     echo " "
  939.     echo "Your $sh doesn't grok # comments--I will strip them later on."
  940.     shsharp=false
  941.     cd ..
  942.     echo "exec grep -v '^[     ]*#'" >spitshell
  943.     chmod +x spitshell
  944.     $eunicefix spitshell
  945.     spitshell=`pwd`/spitshell
  946.     cd UU
  947.     echo "I presume that if # doesn't work, #! won't work either!"
  948.     sharpbang=': use '
  949. fi
  950. rm -f try today
  951.  
  952. : figure out how to guarantee sh startup
  953. case "$startsh" in
  954. '') startsh=${sharpbang}${sh} ;;
  955. *)
  956. esac
  957. cat >try <<EOSS
  958. $startsh
  959. set abc
  960. test "$?abc" != 1
  961. EOSS
  962.  
  963. chmod +x try
  964. $eunicefix try
  965. if ./try; then
  966.     : echo "Yup, it does."
  967. else
  968.     echo "Hmm... '$startsh' does not guarantee sh startup..."
  969.     echo "You may have to fix up the shell scripts to make sure $sh runs them."
  970. fi
  971. rm -f try
  972.  
  973.  
  974. : Save command line options in file UU/cmdline.opt for later use in
  975. : generating config.sh.
  976. cat > cmdline.opt <<EOSH
  977. # Configure command line arguments.
  978. config_arg0='$0'
  979. config_args='$*'
  980. config_argc=$#
  981. EOSH
  982. argn=1
  983. for arg in "$@"; do
  984.     cat >>cmdline.opt <<EOSH
  985. config_arg$argn='$arg'
  986. EOSH
  987.     argn=`expr $argn + 1`
  988. done
  989.  
  990. : produce awk script to parse command line options
  991. cat >options.awk <<'EOF'
  992. BEGIN {
  993.     optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
  994.  
  995.     len = length(optstr);
  996.     for (i = 1; i <= len; i++) {
  997.         c = substr(optstr, i, 1);
  998.         if (i < len) a = substr(optstr, i + 1, 1); else a = "";
  999.         if (a == ":") {
  1000.             arg[c] = 1;
  1001.             i++;
  1002.         }
  1003.         opt[c] = 1;
  1004.     }
  1005. }
  1006. {
  1007.     expect = 0;
  1008.     str = $0;
  1009.     if (substr(str, 1, 1) != "-") {
  1010.         printf("'%s'\n", str);
  1011.         next;
  1012.     }
  1013.     len = length($0);
  1014.     for (i = 2; i <= len; i++) {
  1015.         c = substr(str, i, 1);
  1016.         if (!opt[c]) {
  1017.             printf("-%s\n", substr(str, i));
  1018.             next;
  1019.         }
  1020.         printf("-%s\n", c);
  1021.         if (arg[c]) {
  1022.             if (i < len)
  1023.                 printf("'%s'\n", substr(str, i + 1));
  1024.             else
  1025.                 expect = 1;
  1026.             next;
  1027.         }
  1028.     }
  1029. }
  1030. END {
  1031.     if (expect)
  1032.         print "?";
  1033. }
  1034. EOF
  1035.  
  1036. : process the command line options
  1037. set X `for arg in "$@"; do echo "X$arg"; done |
  1038.     sed -e s/X// | awk -f options.awk`
  1039. eval "set $*"
  1040. shift
  1041. rm -f options.awk
  1042.  
  1043. : set up default values
  1044. fastread=''
  1045. reuseval=false
  1046. config_sh=''
  1047. alldone=''
  1048. error=''
  1049. silent=''
  1050. extractsh=''
  1051. override=''
  1052. knowitall=''
  1053. rm -f optdef.sh
  1054. cat >optdef.sh <<EOS
  1055. $startsh
  1056. EOS
  1057.  
  1058.  
  1059. : option parsing
  1060. while test $# -gt 0; do
  1061.     case "$1" in
  1062.     -d) shift; fastread=yes;;
  1063.     -e) shift; alldone=cont;;
  1064.     -f)
  1065.         shift
  1066.         cd ..
  1067.         if test -r "$1"; then
  1068.             config_sh="$1"
  1069.         else
  1070.             echo "$me: cannot read config file $1." >&2
  1071.             error=true
  1072.         fi
  1073.         cd UU
  1074.         shift;;
  1075.     -h) shift; error=true;;
  1076.     -r) shift; reuseval=true;;
  1077.     -s) shift; silent=true; realsilent=true;;
  1078.     -E) shift; alldone=exit;;
  1079.     -K) shift; knowitall=true;;
  1080.     -O) shift; override=true;;
  1081.     -S) shift; silent=true; extractsh=true;;
  1082.     -D)
  1083.         shift
  1084.         case "$1" in
  1085.         *=)
  1086.             echo "$me: use '-U symbol=', not '-D symbol='." >&2
  1087.             echo "$me: ignoring -D $1" >&2
  1088.             ;;
  1089.         *=*) echo "$1" | \
  1090.                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
  1091.         *) echo "$1='define'" >> optdef.sh;;
  1092.         esac
  1093.         shift
  1094.         ;;
  1095.     -U)
  1096.         shift
  1097.         case "$1" in
  1098.         *=) echo "$1" >> optdef.sh;;
  1099.         *=*)
  1100.             echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
  1101.             echo "$me: ignoring -U $1" >&2
  1102.             ;;
  1103.         *) echo "$1='undef'" >> optdef.sh;;
  1104.         esac
  1105.         shift
  1106.         ;;
  1107.     -V) echo "$me generated by metaconfig 3.0 PL70." >&2
  1108.         exit 0;;
  1109.     --) break;;
  1110.     -*) echo "$me: unknown option $1" >&2; shift; error=true;;
  1111.     *) break;;
  1112.     esac
  1113. done
  1114.  
  1115. case "$error" in
  1116. true)
  1117.     cat >&2 <<EOM
  1118. Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
  1119.                  [-U symbol] [-U symbol=]
  1120.   -d : use defaults for all answers.
  1121.   -e : go on without questioning past the production of config.sh.
  1122.   -f : specify an alternate default configuration file.
  1123.   -h : print this help message and exit (with an error status).
  1124.   -r : reuse C symbols value if possible (skips costly nm extraction).
  1125.   -s : silent mode, only echoes questions and essential information.
  1126.   -D : define symbol to have some value:
  1127.          -D symbol         symbol gets the value 'define'
  1128.          -D symbol=value   symbol gets the value 'value'
  1129.   -E : stop at the end of questions, after having produced config.sh.
  1130.   -K : do not use unless you know what you are doing.
  1131.   -O : let -D and -U override definitions from loaded configuration file.
  1132.   -S : perform variable substitutions on all .SH files (can mix with -f)
  1133.   -U : undefine symbol:
  1134.          -U symbol    symbol gets the value 'undef'
  1135.          -U symbol=   symbol gets completely empty
  1136.   -V : print version number and exit (with a zero status).
  1137. EOM
  1138.     exit 1
  1139.     ;;
  1140. esac
  1141.  
  1142. : Sanity checks
  1143. case "$fastread$alldone" in
  1144. yescont|yesexit) ;;
  1145. *)
  1146.     if test ! -t 0; then
  1147.         echo "Say 'sh Configure', not 'sh <Configure'"
  1148.         exit 1
  1149.     fi
  1150.     ;;
  1151. esac
  1152.  
  1153. exec 4>&1
  1154. case "$silent" in
  1155. true) exec 1>/dev/null;;
  1156. esac
  1157.  
  1158. : run the defines and the undefines, if any, but leave the file out there...
  1159. touch optdef.sh
  1160. . ./optdef.sh
  1161.  
  1162. : set package name
  1163. package=perl5
  1164. first=`echo $package | sed -e 's/^\(.\).*/\1/'`
  1165. last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
  1166. case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
  1167. ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
  1168. *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
  1169. esac
  1170.  
  1171. : Some greps do not return status, grrr.
  1172. echo "grimblepritz" >grimble
  1173. if grep blurfldyick grimble >/dev/null 2>&1 ; then
  1174.     contains=contains
  1175. elif grep grimblepritz grimble >/dev/null 2>&1 ; then
  1176.     contains=grep
  1177. else
  1178.     contains=contains
  1179. fi
  1180. rm -f grimble
  1181. : the following should work in any shell
  1182. case "$contains" in
  1183. contains*)
  1184.     echo " "
  1185.     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
  1186.     cat >contains <<'EOSS'
  1187. grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
  1188. EOSS
  1189. chmod +x contains
  1190. esac
  1191.  
  1192. : Find the path to the source tree
  1193. case "$src" in
  1194. '') case "$0" in
  1195.     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
  1196.     *)   src='.';;
  1197.     esac;;
  1198. esac
  1199. case "$src" in
  1200. '')    src=/
  1201.     rsrc=/
  1202.     ;;
  1203. /*) rsrc="$src";;
  1204. *) rsrc="../$src";;
  1205. esac
  1206. if test -f $rsrc/Configure && \
  1207.     $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
  1208. then
  1209.    : found it, so we are ok.
  1210. else
  1211.     rsrc=''
  1212.     for src in . .. ../.. ../../.. ../../../..; do
  1213.         if test -f ../$src/Configure && \
  1214.             $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
  1215.         then
  1216.             rsrc=../$src
  1217.             break
  1218.         fi
  1219.     done
  1220. fi
  1221. case "$rsrc" in
  1222. '')
  1223.     cat <<EOM >&4
  1224.  
  1225. Sorry, I can't seem to locate the source dir for $package.  Please start
  1226. Configure with an explicit path -- i.e. /some/path/Configure.
  1227.  
  1228. EOM
  1229.     exit 1
  1230.     ;;
  1231. ../.)    rsrc='..';;
  1232. *)
  1233.     echo " "
  1234.     echo "Sources for $package found in \"$src\"." >&4
  1235.     ;;
  1236. esac
  1237.  
  1238. : script used to extract .SH files with variable substitutions
  1239. cat >extract <<'EOS'
  1240. CONFIG=true
  1241. echo "Doing variable substitutions on .SH files..."
  1242. if test -f $src/MANIFEST; then
  1243.     set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
  1244. else
  1245.     echo "(Looking for .SH files under the source directory.)"
  1246.     set x `(cd $src; find . -name "*.SH" -print)`
  1247. fi
  1248. shift
  1249. case $# in
  1250. 0) set x `(cd $src; echo *.SH)`; shift;;
  1251. esac
  1252. if test ! -f $src/$1; then
  1253.     shift
  1254. fi
  1255. mkdir_p='
  1256. name=$1;
  1257. create="";
  1258. while test $name; do
  1259.     if test ! -d "$name"; then
  1260.         create="$name $create";
  1261.         name=`echo $name | sed -e "s|^[^/]*$||"`;
  1262.         name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
  1263.     else
  1264.         name="";
  1265.     fi;
  1266. done;
  1267. for file in $create; do
  1268.     mkdir $file;
  1269. done
  1270. '
  1271. for file in $*; do
  1272.     case "$src" in
  1273.     ".")
  1274.         case "$file" in
  1275.         */*)
  1276.             dir=`expr X$file : 'X\(.*\)/'`
  1277.             file=`expr X$file : 'X.*/\(.*\)'`
  1278.             (cd $dir && . ./$file)
  1279.             ;;
  1280.         *)
  1281.             . ./$file
  1282.             ;;
  1283.         esac
  1284.         ;;
  1285.     *)
  1286.         case "$file" in
  1287.         */*)
  1288.             dir=`expr X$file : 'X\(.*\)/'`
  1289.             file=`expr X$file : 'X.*/\(.*\)'`
  1290.             (set x $dir; shift; eval $mkdir_p)
  1291.             sh <$src/$dir/$file
  1292.             ;;
  1293.         *)
  1294.             sh <$src/$file
  1295.             ;;
  1296.         esac
  1297.         ;;
  1298.     esac
  1299. done
  1300. if test -f $src/config_h.SH; then
  1301.     if test ! -f config.h; then
  1302.     : oops, they left it out of MANIFEST, probably, so do it anyway.
  1303.     . $src/config_h.SH
  1304.     fi
  1305. fi
  1306. EOS
  1307.  
  1308. : extract files and exit if asked to do so
  1309. case "$extractsh" in
  1310. true)
  1311.     case "$realsilent" in
  1312.     true) ;;
  1313.     *) exec 1>&4;;
  1314.     esac
  1315.     case "$config_sh" in
  1316.     '') config_sh='config.sh';;
  1317.     esac
  1318.     echo " "
  1319.     echo "Fetching answers from $config_sh..."
  1320.     cd ..
  1321.     . $config_sh
  1322.     test "$override" && . ./optdef.sh
  1323.     echo " "
  1324.     . UU/extract
  1325.     rm -rf UU
  1326.     echo "Done."
  1327.     exit 0
  1328.     ;;
  1329. esac
  1330.  
  1331. : Eunice requires " " instead of "", can you believe it
  1332. echo " "
  1333. : Here we go...
  1334. echo "Beginning of configuration questions for $package."
  1335.  
  1336. trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
  1337.  
  1338. : first determine how to suppress newline on echo command
  1339. echo " "
  1340. echo "Checking echo to see how to suppress newlines..."
  1341. (echo "hi there\c" ; echo " ") >.echotmp
  1342. if $contains c .echotmp >/dev/null 2>&1 ; then
  1343.     echo "...using -n."
  1344.     n='-n'
  1345.     c=''
  1346. else
  1347.     cat <<'EOM'
  1348. ...using \c
  1349. EOM
  1350.     n=''
  1351.     c='\c'
  1352. fi
  1353. echo $n "The star should be here-->$c"
  1354. echo '*'
  1355. rm -f .echotmp
  1356.  
  1357. : Now test for existence of everything in MANIFEST
  1358. echo " "
  1359. if test -f $rsrc/MANIFEST; then
  1360.     echo "First let's make sure your kit is complete.  Checking..." >&4
  1361.     awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
  1362.     rm -f missing
  1363.     tmppwd=`pwd`
  1364.     for filelist in x??; do
  1365.         (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
  1366.     done
  1367.     if test -s missing; then
  1368.         cat missing >&4
  1369.         cat >&4 <<'EOM'
  1370.  
  1371. THIS PACKAGE SEEMS TO BE INCOMPLETE.
  1372.  
  1373. You have the option of continuing the configuration process, despite the
  1374. distinct possibility that your kit is damaged, by typing 'y'es.  If you
  1375. do, don't blame me if something goes wrong.  I advise you to type 'n'o
  1376. and contact the author (doughera@lafayette.edu).
  1377.  
  1378. EOM
  1379.         echo $n "Continue? [n] $c" >&4
  1380.         read ans
  1381.         case "$ans" in
  1382.         y*)
  1383.             echo "Continuing..." >&4
  1384.             rm -f missing
  1385.             ;;
  1386.         *)
  1387.             echo "ABORTING..." >&4
  1388.             kill $$
  1389.             ;;
  1390.         esac
  1391.     else
  1392.         echo "Looks good..."
  1393.     fi
  1394. else
  1395.     echo "There is no MANIFEST file.  I hope your kit is complete !"
  1396. fi
  1397. rm -f missing x??
  1398.  
  1399. : compute the number of columns on the terminal for proper question formatting
  1400. case "$COLUMNS" in
  1401. '') COLUMNS='80';;
  1402. esac
  1403.  
  1404. : set up the echo used in my read
  1405. myecho="case \"\$xxxm\" in
  1406. '') echo $n \"\$rp $c\" >&4;;
  1407. *) case \"\$rp\" in
  1408.     '') echo $n \"[\$xxxm] $c\";;
  1409.     *)
  1410.         if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
  1411.             echo \"\$rp\" >&4
  1412.             echo $n \"[\$xxxm] $c\" >&4
  1413.         else
  1414.             echo $n \"\$rp [\$xxxm] $c\" >&4
  1415.         fi
  1416.         ;;
  1417.     esac;;
  1418. esac"
  1419.  
  1420. : now set up to do reads with possible shell escape and default assignment
  1421. cat <<EOSC >myread
  1422. $startsh
  1423. xxxm=\$dflt
  1424. $myecho
  1425. ans='!'
  1426. case "\$fastread" in
  1427. yes) case "\$dflt" in
  1428.     '') ;;
  1429.     *) ans='';
  1430.         case "\$silent-\$rp" in
  1431.         true-) ;;
  1432.         *) echo " " >&4;;
  1433.         esac;;
  1434.     esac;;
  1435. *) case "\$silent" in
  1436.     true) case "\$rp" in
  1437.         '') ans='';;
  1438.         esac;;
  1439.     esac;;
  1440. esac
  1441. while expr "X\$ans" : "X!" >/dev/null; do
  1442.     read answ
  1443.     set x \$xxxm
  1444.     shift
  1445.     aok=''; eval "ans=\\"\$answ\\"" && aok=y
  1446.     case  "\$answ" in
  1447.     "!")
  1448.         sh 1>&4
  1449.         echo " "
  1450.         $myecho
  1451.         ;;
  1452.     !*)
  1453.         set x \`expr "X\$ans" : "X!\(.*\)\$"\`
  1454.         shift
  1455.         sh 1>&4 -c "\$*"
  1456.         echo " "
  1457.         $myecho
  1458.         ;;
  1459.     "\$ans")
  1460.         case "\$ans" in
  1461.         \\&*)
  1462.             set x \`expr "X\$ans" : "X&\(.*\)\$"\`
  1463.             shift
  1464.             case "\$1" in
  1465.             -d)
  1466.                 fastread=yes
  1467.                 echo "(OK, I'll run with -d after this question.)" >&4
  1468.                 ;;
  1469.             -*)
  1470.                 echo "*** Sorry, \$1 not supported yet." >&4
  1471.                 ;;
  1472.             esac
  1473.             $myecho
  1474.             ans=!
  1475.             ;;
  1476.         esac;;
  1477.     *)
  1478.         case "\$aok" in
  1479.         y)
  1480.             echo "*** Substitution done -- please confirm."
  1481.             xxxm="\$ans"
  1482.             ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
  1483.             xxxm="\$ans"
  1484.             ans=!
  1485.             ;;
  1486.         *)
  1487.             echo "*** Error -- try again."
  1488.             ans=!
  1489.             ;;
  1490.         esac
  1491.         $myecho
  1492.         ;;
  1493.     esac
  1494.     case "\$ans\$xxxm\$nostick" in
  1495.     '')
  1496.         ans=!
  1497.         $myecho
  1498.         ;;
  1499.     esac
  1500. done
  1501. case "\$ans" in
  1502. '') ans="\$xxxm";;
  1503. esac
  1504. EOSC
  1505.  
  1506. : create .config dir to save info across Configure sessions
  1507. test -d ../.config || mkdir ../.config
  1508. cat >../.config/README <<EOF
  1509. This directory created by Configure to save information that should
  1510. persist across sessions for $package.
  1511.  
  1512. You may safely delete it if you wish.
  1513. EOF
  1514.  
  1515. : general instructions
  1516. needman=true
  1517. firsttime=true
  1518. user=`(logname) 2>/dev/null`
  1519. case "$user" in
  1520. '') user=`whoami 2>&1`;;
  1521. esac
  1522. if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
  1523.     firsttime=false
  1524.     echo " "
  1525.     rp='Would you like to see the instructions?'
  1526.     dflt=n
  1527.     . ./myread
  1528.     case "$ans" in
  1529.     [yY]*) ;;
  1530.     *) needman=false;;
  1531.     esac
  1532. fi
  1533. if $needman; then
  1534.     cat <<EOH
  1535.  
  1536. This installation shell script will examine your system and ask you questions
  1537. to determine how the perl5 package should be installed. If you get
  1538. stuck on a question, you may use a ! shell escape to start a subshell or
  1539. execute a command.  Many of the questions will have default answers in square
  1540. brackets; typing carriage return will give you the default.
  1541.  
  1542. On some of the questions which ask for file or directory names you are allowed
  1543. to use the ~name construct to specify the login directory belonging to "name",
  1544. even if you don't have a shell which knows about that.  Questions where this is
  1545. allowed will be marked "(~name ok)".
  1546.  
  1547. EOH
  1548.     rp=''
  1549.     dflt='Type carriage return to continue'
  1550.     . ./myread
  1551.     cat <<'EOH'
  1552.  
  1553. The prompter used in this script allows you to use shell variables and
  1554. backticks in your answers.  You may use $1, $2, etc...  to refer to the words
  1555. in the default answer, as if the default line was a set of arguments given to a
  1556. script shell.  This means you may also use $* to repeat the whole default line,
  1557. so you do not have to re-type everything to add something to the default.
  1558.  
  1559. Everytime there is a substitution, you will have to confirm.  If there is an
  1560. error (e.g. an unmatched backtick), the default answer will remain unchanged
  1561. and you will be prompted again.
  1562.  
  1563. If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
  1564. the questions and use the computed defaults (or the previous answers if there
  1565. was already a config.sh file). Type 'Configure -h' for a list of options.
  1566. You may also start interactively and then answer '& -d' at any prompt to turn
  1567. on the non-interactive behaviour for the remainder of the execution.
  1568.  
  1569. EOH
  1570.     . ./myread
  1571.     cat <<EOH
  1572.  
  1573. Much effort has been expended to ensure that this shell script will run on any
  1574. Unix system.  If despite that it blows up on yours, your best bet is to edit
  1575. Configure and run it again.  If you can't run Configure for some reason,
  1576. you'll have to generate a config.sh file by hand.  Whatever problems you
  1577. have, let me (doughera@lafayette.edu) know how I blew it.
  1578.  
  1579. This installation script affects things in two ways:
  1580.  
  1581. 1) it may do direct variable substitutions on some of the files included
  1582.    in this kit.
  1583. 2) it builds a config.h file for inclusion in C programs.  You may edit
  1584.    any of these files as the need arises after running this script.
  1585.  
  1586. If you make a mistake on a question, there is no easy way to back up to it
  1587. currently.  The easiest thing to do is to edit config.sh and rerun all the SH
  1588. files.  Configure will offer to let you do this before it runs the SH files.
  1589.  
  1590. EOH
  1591.     dflt='Type carriage return to continue'
  1592.     . ./myread
  1593.     case "$firsttime" in
  1594.     true) echo $user >>../.config/instruct;;
  1595.     esac
  1596. fi
  1597.  
  1598. : find out where common programs are
  1599. echo " "
  1600. echo "Locating common programs..." >&4
  1601. cat <<EOSC >loc
  1602. $startsh
  1603. case \$# in
  1604. 0) exit 1;;
  1605. esac
  1606. thing=\$1
  1607. shift
  1608. dflt=\$1
  1609. shift
  1610. for dir in \$*; do
  1611.     case "\$thing" in
  1612.     .)
  1613.     if test -d \$dir/\$thing; then
  1614.         echo \$dir
  1615.         exit 0
  1616.     fi
  1617.     ;;
  1618.     *)
  1619.     for thisthing in \$dir/\$thing; do
  1620.         : just loop through to pick last item
  1621.     done
  1622.     if test -f \$thisthing; then
  1623.         echo \$thisthing
  1624.         exit 0
  1625.     elif test -f \$dir/\$thing.exe; then
  1626.         if test -n "$DJGPP"; then
  1627.             echo \$dir/\$thing.exe
  1628.         else
  1629.             : on Eunice apparently
  1630.             echo \$dir/\$thing
  1631.         fi
  1632.         exit 0
  1633.     fi
  1634.     ;;
  1635.     esac
  1636. done
  1637. echo \$dflt
  1638. exit 1
  1639. EOSC
  1640. chmod +x loc
  1641. $eunicefix loc
  1642. loclist="
  1643. awk
  1644. cat
  1645. comm
  1646. cp
  1647. echo
  1648. expr
  1649. find
  1650. grep
  1651. ls
  1652. make
  1653. mkdir
  1654. rm
  1655. sed
  1656. sort
  1657. touch
  1658. tr
  1659. uniq
  1660. "
  1661. trylist="
  1662. Mcc
  1663. ar
  1664. byacc
  1665. cpp
  1666. csh
  1667. date
  1668. egrep
  1669. gzip
  1670. less
  1671. line
  1672. ln
  1673. more
  1674. nm
  1675. nroff
  1676. perl
  1677. pg
  1678. sendmail
  1679. tee
  1680. test
  1681. uname
  1682. zip
  1683. "
  1684. pth=`echo $PATH | sed -e "s/$p_/ /g"`
  1685. pth="$pth /lib /usr/lib"
  1686. for file in $loclist; do
  1687.     eval xxx=\$$file
  1688.     case "$xxx" in
  1689.     /*|?:[\\/]*)
  1690.         if test -f "$xxx"; then
  1691.             : ok
  1692.         else
  1693.             echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
  1694.             xxx=`./loc $file $file $pth`
  1695.         fi
  1696.         ;;
  1697.     '') xxx=`./loc $file $file $pth`;;
  1698.     *) xxx=`./loc $xxx $xxx $pth`;;
  1699.     esac
  1700.     eval $file=$xxx
  1701.     eval _$file=$xxx
  1702.     case "$xxx" in
  1703.     /*)
  1704.         echo $file is in $xxx.
  1705.         ;;
  1706.     ?:[\\/]*)
  1707.         echo $file is in $xxx.
  1708.         ;;
  1709.     *)
  1710.         echo "I don't know where '$file' is, and my life depends on it." >&4
  1711.         echo "Go find a public domain implementation or fix your PATH setting!" >&4
  1712.         exit 1
  1713.         ;;
  1714.     esac
  1715. done
  1716. echo " "
  1717. echo "Don't worry if any of the following aren't found..."
  1718. say=offhand
  1719. for file in $trylist; do
  1720.     eval xxx=\$$file
  1721.     case "$xxx" in
  1722.     /*|?:[\\/]*)
  1723.         if test -f "$xxx"; then
  1724.             : ok
  1725.         else
  1726.             echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
  1727.             xxx=`./loc $file $file $pth`
  1728.         fi
  1729.         ;;
  1730.     '') xxx=`./loc $file $file $pth`;;
  1731.     *) xxx=`./loc $xxx $xxx $pth`;;
  1732.     esac
  1733.     eval $file=$xxx
  1734.     eval _$file=$xxx
  1735.     case "$xxx" in
  1736.     /*)
  1737.         echo $file is in $xxx.
  1738.         ;;
  1739.     ?:[\\/]*)
  1740.         echo $file is in $xxx.
  1741.         ;;
  1742.     *)
  1743.         echo "I don't see $file out there, $say."
  1744.         say=either
  1745.         ;;
  1746.     esac
  1747. done
  1748. case "$egrep" in
  1749. egrep)
  1750.     echo "Substituting grep for egrep."
  1751.     egrep=$grep
  1752.     ;;
  1753. esac
  1754. case "$ln" in
  1755. ln)
  1756.     echo "Substituting cp for ln."
  1757.     ln=$cp
  1758.     ;;
  1759. esac
  1760. case "$test" in
  1761. test)
  1762.     echo "Hopefully test is built into your sh."
  1763.     ;;
  1764. *)
  1765.     if `sh -c "PATH= test true" >/dev/null 2>&1`; then
  1766.         echo "Using the test built into your sh."
  1767.         test=test
  1768.         _test=test
  1769.     fi
  1770.     ;;
  1771. esac
  1772. case "$echo" in
  1773. echo)
  1774.     echo "Hopefully echo is built into your sh."
  1775.     ;;
  1776. '') ;;
  1777. *)
  1778.     echo " "
  1779. echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
  1780.     $echo $n "hi there$c" >foo1
  1781.     echo $n "hi there$c" >foo2
  1782.     if cmp foo1 foo2 >/dev/null 2>&1; then
  1783.         echo "They are compatible.  In fact, they may be identical."
  1784.     else
  1785.         case "$n" in
  1786.         '-n') n='' c='\c';;
  1787.         *) n='-n' c='';;
  1788.         esac
  1789.         cat <<FOO
  1790. They are not compatible!  You are probably running ksh on a non-USG system.
  1791. I'll have to use $echo instead of the builtin, since Bourne shell doesn't
  1792. have echo built in and we may have to run some Bourne shell scripts.  That
  1793. means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
  1794.  
  1795. FOO
  1796.         $echo $n "The star should be here-->$c"
  1797.         $echo "*"
  1798.     fi
  1799.     $rm -f foo1 foo2
  1800.     ;;
  1801. esac
  1802.  
  1803. : determine whether symbolic links are supported
  1804. echo " "
  1805. $touch blurfl
  1806. if $ln -s blurfl sym > /dev/null 2>&1 ; then
  1807.     echo "Symbolic links are supported." >&4
  1808.     lns="$ln -s"
  1809. else
  1810.     echo "Symbolic links are NOT supported." >&4
  1811.     lns="$ln"
  1812. fi
  1813. $rm -f blurfl sym
  1814.  
  1815. : see whether [:lower:] and [:upper:] are supported character classes
  1816. echo " "
  1817. case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
  1818. ABYZ)
  1819.     echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
  1820.     up='[:upper:]'
  1821.     low='[:lower:]'
  1822.     ;;
  1823. *)    # There is a discontinuity in EBCDIC between 'I' and 'J'
  1824.         # (0xc9 and 0xd1), therefore that is a nice testing point.
  1825.         if test "X$up" = X -o "X$low" = X; then
  1826.         case "`echo IJ | tr '[I-J]' '[i-j]' 2>/dev/null`" in
  1827.         ij) up='[A-Z]'
  1828.             low='[a-z]'
  1829.         ;;
  1830.         esac
  1831.         fi
  1832.     if test "X$up" = X -o "X$low" = X; then
  1833.         case "`echo IJ | tr I-J i-j 2>/dev/null`" in
  1834.         ij) up='A-Z'
  1835.         low='a-z'
  1836.         ;;
  1837.         esac
  1838.         fi
  1839.     if test "X$up" = X -o "X$low" = X; then
  1840.         case "`echo IJ | od -x 2>/dev/null`" in
  1841.         *C9D1*|*c9d1*)
  1842.         echo "Hey, this might be EBCDIC." >&4
  1843.         if test "X$up" = X -o "X$low" = X; then
  1844.             case "`echo IJ | tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
  1845.             ij) up='[A-IJ-RS-Z]'
  1846.                 low='[a-ij-rs-z]'
  1847.             ;;
  1848.             esac
  1849.         fi
  1850.         if test "X$up" = X -o "X$low" = X; then
  1851.             case "`echo IJ | tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
  1852.             ij) up='A-IJ-RS-Z'
  1853.                 low='a-ij-rs-z'
  1854.             ;;
  1855.             esac
  1856.         fi
  1857.         ;;
  1858.         esac
  1859.     fi
  1860. esac
  1861. case "`echo IJ | tr \"$up\" \"$low\" 2>/dev/null`" in
  1862. ij)
  1863.     echo "Using $up and $low to convert case." >&4
  1864.     ;;
  1865. *)
  1866.     echo "I don't know how to translate letters from upper to lower case." >&4
  1867.     echo "Your tr is not acting any way I know of." >&4
  1868.     exit 1
  1869.     ;;
  1870. esac
  1871. : set up the translation script tr, must be called with ./tr of course
  1872. cat >tr <<EOSC
  1873. $startsh
  1874. case "\$1\$2" in
  1875. '[A-Z][a-z]') exec $tr '$up' '$low';;
  1876. '[a-z][A-Z]') exec $tr '$low' '$up';;
  1877. esac
  1878. exec $tr "\$@"
  1879. EOSC
  1880. chmod +x tr
  1881. $eunicefix tr
  1882.  
  1883. : Try to determine whether config.sh was made on this system
  1884. case "$config_sh" in
  1885. '')
  1886. myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
  1887. # tr '[A-Z]' '[a-z]' would not work in EBCDIC
  1888. # because the A-Z/a-z are not consecutive.
  1889. myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
  1890.     ./tr '[A-Z]' '[a-z]' | tr $trnl ' '`
  1891. newmyuname="$myuname"
  1892. dflt=n
  1893. case "$knowitall" in
  1894. '')
  1895.     if test -f ../config.sh; then
  1896.         if $contains myuname= ../config.sh >/dev/null 2>&1; then
  1897.             eval "`grep myuname= ../config.sh`"
  1898.         fi
  1899.         if test "X$myuname" = "X$newmyuname"; then
  1900.             dflt=y
  1901.         fi
  1902.     fi
  1903.     ;;
  1904. *) dflt=y;;
  1905. esac
  1906.  
  1907. : Get old answers from old config file if Configure was run on the
  1908. : same system, otherwise use the hints.
  1909. hint=default
  1910. cd ..
  1911. if test -f config.sh; then
  1912.     echo " "
  1913.     rp="I see a config.sh file.  Shall I use it to set the defaults?"
  1914.     . UU/myread
  1915.     case "$ans" in
  1916.     n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
  1917.     *)  echo "Fetching default answers from your old config.sh file..." >&4
  1918.         tmp_n="$n"
  1919.         tmp_c="$c"
  1920.         tmp_sh="$sh"
  1921.         . ./config.sh
  1922.         cp config.sh UU
  1923.         n="$tmp_n"
  1924.         c="$tmp_c"
  1925.         : Older versions did not always set $sh.  Catch re-use of such
  1926.         : an old config.sh.
  1927.         case "$sh" in
  1928.         '') sh="$tmp_sh" ;;
  1929.         esac
  1930.         hint=previous
  1931.         ;;
  1932.     esac
  1933. fi
  1934. if test ! -f config.sh; then
  1935.     $cat <<EOM
  1936.  
  1937. First time through, eh?  I have some defaults handy for some systems
  1938. that need some extra help getting the Configure answers right:
  1939.  
  1940. EOM
  1941.     (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
  1942.     dflt=''
  1943.     : Half the following guesses are probably wrong... If you have better
  1944.     : tests or hints, please send them to doughera@lafayette.edu
  1945.     : The metaconfig authors would also appreciate a copy...
  1946.     $test -f /irix && osname=irix
  1947.     $test -f /xenix && osname=sco_xenix
  1948.     $test -f /dynix && osname=dynix
  1949.     $test -f /dnix && osname=dnix
  1950.     $test -f /lynx.os && osname=lynxos
  1951.     $test -f /unicos && osname=unicos && osvers=`$uname -r`
  1952.     $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
  1953.     $test -f /bin/mips && /bin/mips && osname=mips
  1954.     $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
  1955.         $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
  1956.     $test -d /usr/apollo/bin && osname=apollo
  1957.     $test -f /etc/saf/_sactab && osname=svr4
  1958.     $test -d /usr/include/minix && osname=minix
  1959.     if $test -d /MachTen; then
  1960.         osname=machten
  1961.         if $test -x /sbin/version; then
  1962.             osvers=`/sbin/version | $awk '{print $2}' |
  1963.             $sed -e 's/[A-Za-z]$//'`
  1964.         elif $test -x /usr/etc/version; then
  1965.             osvers=`/usr/etc/version | $awk '{print $2}' |
  1966.             $sed -e 's/[A-Za-z]$//'`
  1967.         else
  1968.             osvers="$2.$3"
  1969.         fi
  1970.     fi
  1971.     if $test -f $uname; then
  1972.         set X $myuname
  1973.         shift
  1974.  
  1975.         case "$5" in
  1976.         fps*) osname=fps ;;
  1977.         mips*)
  1978.             case "$4" in
  1979.             umips) osname=umips ;;
  1980.             *) osname=mips ;;
  1981.             esac;;
  1982.         [23]100) osname=mips ;;
  1983.         next*) osname=next ;;
  1984.         i386*)
  1985.             if $test -f /etc/kconfig; then
  1986.                 osname=isc
  1987.                 if test "$lns" = "ln -s"; then
  1988.                     osvers=4
  1989.                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
  1990.                     osvers=3
  1991.                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
  1992.                     osvers=2
  1993.                 fi
  1994.             fi
  1995.             ;;
  1996.         pc*)
  1997.             if test -n "$DJGPP"; then
  1998.                 osname=dos
  1999.                 osvers=djgpp
  2000.             fi
  2001.             ;;
  2002.         esac
  2003.  
  2004.         case "$1" in
  2005.         aix) osname=aix
  2006.             tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
  2007.             case "$tmp" in
  2008.             'not found') osvers="$4"."$3" ;;
  2009.             '<3240'|'<>3240') osvers=3.2.0 ;;
  2010.             '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
  2011.             '=3250'|'>3250') osvers=3.2.5 ;;
  2012.             *) osvers=$tmp;;
  2013.             esac
  2014.             ;;
  2015.         *dc.osx) osname=dcosx
  2016.             osvers="$3"
  2017.             ;;
  2018.         dnix) osname=dnix
  2019.             osvers="$3"
  2020.             ;;
  2021.         domainos) osname=apollo
  2022.             osvers="$3"
  2023.             ;;
  2024.         dgux) osname=dgux 
  2025.             osvers="$3"
  2026.             ;;
  2027.         dynixptx*) osname=dynixptx
  2028.             osvers="$3"
  2029.             ;;
  2030.         freebsd) osname=freebsd 
  2031.             osvers="$3" ;;
  2032.         genix) osname=genix ;;
  2033.         hp*) osname=hpux 
  2034.             osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
  2035.             ;;
  2036.         irix*) osname=irix
  2037.             case "$3" in
  2038.             4*) osvers=4 ;;
  2039.             5*) osvers=5 ;;
  2040.             *)    osvers="$3" ;;
  2041.             esac
  2042.             ;;
  2043.         linux) osname=linux
  2044.             case "$3" in
  2045.             *)    osvers="$3" ;;
  2046.             esac
  2047.             ;;
  2048.         MiNT) osname=mint
  2049.             ;;
  2050.         netbsd*) osname=netbsd
  2051.             osvers="$3"
  2052.             ;;
  2053.         news-os) osvers="$3"
  2054.             case "$3" in
  2055.             4*) osname=newsos4 ;;
  2056.             *) osname=newsos ;;
  2057.             esac
  2058.             ;;
  2059.         bsd386) osname=bsd386
  2060.             osvers=`$uname -r`
  2061.             ;;
  2062.         powerux | power_ux | powermax_os | powermaxos | \
  2063.         powerunix | power_unix) osname=powerux
  2064.             osvers="$3"
  2065.             ;;
  2066.         next*) osname=next ;;
  2067.         solaris) osname=solaris
  2068.             case "$3" in
  2069.             5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
  2070.             *)    osvers="$3" ;;
  2071.             esac
  2072.             ;;
  2073.         sunos) osname=sunos
  2074.             case "$3" in
  2075.             5*) osname=solaris
  2076.                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
  2077.             *)    osvers="$3" ;;
  2078.             esac
  2079.             ;;
  2080.         titanos) osname=titanos
  2081.             case "$3" in
  2082.             1*) osvers=1 ;;
  2083.             2*) osvers=2 ;;
  2084.             3*) osvers=3 ;;
  2085.             4*) osvers=4 ;;
  2086.             *)    osvers="$3" ;;
  2087.             esac
  2088.             ;;
  2089.         ultrix) osname=ultrix
  2090.             osvers="$3"
  2091.             ;;
  2092.         osf1|mls+)    case "$5" in
  2093.                 alpha)
  2094.                     osname=dec_osf
  2095.                     osvers=`echo "$3" | sed 's/^[xvt]//'`
  2096.                     ;;
  2097.             hp*)    osname=hp_osf1    ;;
  2098.             mips)    osname=mips_osf1 ;;
  2099.             esac
  2100.             ;;
  2101.         uts) osname=uts 
  2102.             osvers="$3"
  2103.             ;;
  2104.         qnx) osname=qnx
  2105.             osvers="$4"
  2106.             ;;
  2107.         $2) case "$osname" in
  2108.             *isc*) ;;
  2109.             *freebsd*) ;;
  2110.             svr*)
  2111.                 : svr4.x or possibly later
  2112.                 case "svr$3" in    
  2113.                 ${osname}*)
  2114.                     osname=svr$3
  2115.                     osvers=$4
  2116.                     ;;
  2117.                 esac
  2118.                 case "$osname" in
  2119.                 svr4.0)
  2120.                     : Check for ESIX
  2121.                     if test -f /stand/boot ; then
  2122.                         eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
  2123.                         if test -n "$INITPROG" -a -f "$INITPROG"; then
  2124.             isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
  2125.                             if test -n "$isesix"; then
  2126.                                 osname=esix4
  2127.                             fi
  2128.                         fi
  2129.                     fi
  2130.                     ;;
  2131.                 esac
  2132.                 ;;
  2133.             *)    if test -f /etc/systemid; then
  2134.                     osname=sco
  2135.                     set `echo $3 | $sed 's/\./ /g'` $4
  2136.                     if $test -f $src/hints/sco_$1_$2_$3.sh; then
  2137.                         osvers=$1.$2.$3
  2138.                     elif $test -f $src/hints/sco_$1_$2.sh; then
  2139.                         osvers=$1.$2
  2140.                     elif $test -f $src/hints/sco_$1.sh; then
  2141.                         osvers=$1
  2142.                     fi
  2143.                 else
  2144.                     case "$osname" in
  2145.                     '') : Still unknown.  Probably a generic Sys V.
  2146.                         osname="sysv"
  2147.                         osvers="$3"
  2148.                         ;;
  2149.                     esac
  2150.                 fi
  2151.                 ;;
  2152.             esac
  2153.             ;;
  2154.         *)    case "$osname" in
  2155.             '') : Still unknown.  Probably a generic BSD.
  2156.                 osname="$1"
  2157.                 osvers="$3"
  2158.                 ;;
  2159.             esac
  2160.             ;;
  2161.         esac
  2162.     else
  2163.         if test -f /vmunix -a -f $src/hints/news_os.sh; then
  2164.             (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
  2165.             if $contains news-os UU/kernel.what >/dev/null 2>&1; then
  2166.                 osname=news_os
  2167.             fi
  2168.             $rm -f UU/kernel.what
  2169.         elif test -d c:/.; then
  2170.             set X $myuname
  2171.             osname=os2
  2172.             osvers="$5"
  2173.         fi
  2174.     fi
  2175.     
  2176.     : Now look for a hint file osname_osvers, unless one has been
  2177.     : specified already.
  2178.     case "$hintfile" in
  2179.     ''|' ')
  2180.         file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
  2181.         : Also try without trailing minor version numbers.
  2182.         xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
  2183.         xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
  2184.         xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
  2185.         xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
  2186.         case "$file" in
  2187.         '') dflt=none ;;
  2188.         *)  case "$osvers" in
  2189.             '') dflt=$file
  2190.                 ;;
  2191.             *)  if $test -f $src/hints/$file.sh ; then
  2192.                     dflt=$file
  2193.                 elif $test -f $src/hints/$xfile.sh ; then
  2194.                     dflt=$xfile
  2195.                 elif $test -f $src/hints/$xxfile.sh ; then
  2196.                     dflt=$xxfile
  2197.                 elif $test -f $src/hints/$xxxfile.sh ; then
  2198.                     dflt=$xxxfile
  2199.                 elif $test -f $src/hints/$xxxxfile.sh ; then
  2200.                     dflt=$xxxxfile
  2201.                 elif $test -f "$src/hints/${osname}.sh" ; then
  2202.                     dflt="${osname}"
  2203.                 else
  2204.                     dflt=none
  2205.                 fi
  2206.                 ;;
  2207.             esac
  2208.             ;;
  2209.         esac
  2210.         if $test -f Policy.sh ; then
  2211.             case "$dflt" in
  2212.             *Policy*) ;;
  2213.             none) dflt="Policy" ;;
  2214.             *) dflt="Policy $dflt" ;;
  2215.             esac
  2216.         fi
  2217.         ;;
  2218.     *)
  2219.         dflt=`echo $hintfile | $sed 's/\.sh$//'`
  2220.         ;;
  2221.     esac
  2222.  
  2223.     if $test -f Policy.sh ; then
  2224.         $cat <<EOM
  2225.  
  2226. There's also a Policy hint file available, which should make the
  2227. site-specific (policy) questions easier to answer.
  2228. EOM
  2229.  
  2230.     fi
  2231.  
  2232.     $cat <<EOM
  2233.  
  2234. You may give one or more space-separated answers, or "none" if appropriate.
  2235. A well-behaved OS will have no hints, so answering "none" or just "Policy"
  2236. is a good thing.  DO NOT give a wrong version.
  2237.  
  2238. EOM
  2239.  
  2240.     rp="Which of these apply, if any?"
  2241.     . UU/myread
  2242.     tans=$ans
  2243.     for file in $tans; do
  2244.         if $test X$file = XPolicy -a -f Policy.sh; then
  2245.             . Policy.sh
  2246.             $cat Policy.sh >> UU/config.sh
  2247.         elif $test -f $src/hints/$file.sh; then
  2248.             . $src/hints/$file.sh
  2249.             $cat $src/hints/$file.sh >> UU/config.sh
  2250.         elif $test X$tans = X -o X$tans = Xnone ; then
  2251.             : nothing
  2252.         else
  2253.             : Give one chance to correct a possible typo.
  2254.             echo "$file.sh does not exist"
  2255.             dflt=$file
  2256.             rp="hint to use instead?"
  2257.             . UU/myread
  2258.             for file in $ans; do
  2259.                 if $test -f "$src/hints/$file.sh"; then
  2260.                     . $src/hints/$file.sh
  2261.                     $cat $src/hints/$file.sh >> UU/config.sh
  2262.                 elif $test X$ans = X -o X$ans = Xnone ; then
  2263.                     : nothing
  2264.                 else
  2265.                     echo "$file.sh does not exist -- ignored."
  2266.                 fi
  2267.             done
  2268.         fi
  2269.     done
  2270.  
  2271.     hint=recommended
  2272.     : Remember our hint file for later.
  2273.     if $test -f "$src/hints/$file.sh" ; then
  2274.         hintfile="$file"
  2275.     else
  2276.         hintfile=''
  2277.     fi
  2278. fi
  2279. cd UU
  2280. ;;
  2281. *)
  2282.     echo " "
  2283.     echo "Fetching default answers from $config_sh..." >&4
  2284.     tmp_n="$n"
  2285.     tmp_c="$c"
  2286.     cd ..
  2287.     cp $config_sh config.sh 2>/dev/null
  2288.     chmod +w config.sh
  2289.     . ./config.sh
  2290.     cd UU
  2291.     cp ../config.sh .
  2292.     n="$tmp_n"
  2293.     c="$tmp_c"
  2294.     hint=previous
  2295.     ;;
  2296. esac
  2297. test "$override" && . ./optdef.sh
  2298. myuname="$newmyuname"
  2299.  
  2300. : Restore computed paths
  2301. for file in $loclist $trylist; do
  2302.     eval $file="\$_$file"
  2303. done
  2304.  
  2305. cat << EOM
  2306.  
  2307. Configure uses the operating system name and version to set some defaults.
  2308. The default value is probably right if the name rings a bell. Otherwise,
  2309. since spelling matters for me, either accept the default or answer "none"
  2310. to leave it blank.
  2311.  
  2312. EOM
  2313. case "$osname" in
  2314.     ''|' ')
  2315.         case "$hintfile" in
  2316.         ''|' '|none) dflt=none ;;
  2317.         *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
  2318.         esac
  2319.         ;;
  2320.     *) dflt="$osname" ;;
  2321. esac
  2322. rp="Operating system name?"
  2323. . ./myread
  2324. case "$ans" in
  2325. none)  osname='' ;;
  2326. *) osname=`echo "$ans" | $sed -e 's/[     ][    ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
  2327. esac
  2328. echo " "
  2329. case "$osvers" in
  2330.     ''|' ')
  2331.         case "$hintfile" in
  2332.         ''|' '|none) dflt=none ;;
  2333.         *)    dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
  2334.             dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
  2335.             case "$dflt" in
  2336.             ''|' ') dflt=none ;;
  2337.             esac
  2338.             ;;
  2339.         esac
  2340.         ;;
  2341.     *) dflt="$osvers" ;;
  2342. esac
  2343. rp="Operating system version?"
  2344. . ./myread
  2345. case "$ans" in
  2346. none)  osvers='' ;;
  2347. *) osvers="$ans" ;;
  2348. esac
  2349.  
  2350. : who configured the system
  2351. cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
  2352. cf_by=`(logname) 2>/dev/null`
  2353. case "$cf_by" in
  2354. "")
  2355.     cf_by=`(whoami) 2>/dev/null`
  2356.     case "$cf_by" in
  2357.     "") cf_by=unknown ;;
  2358.     esac ;;
  2359. esac
  2360.  
  2361. : set up the script used to warn in case of inconsistency
  2362. cat <<EOS >whoa
  2363. $startsh
  2364. EOS
  2365. cat <<'EOSC' >>whoa
  2366. dflt=y
  2367. echo " "
  2368. echo "*** WHOA THERE!!! ***" >&4
  2369. echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
  2370. rp="    Keep the $hint value?"
  2371. . ./myread
  2372. case "$ans" in
  2373. y) td=$was; tu=$was;;
  2374. esac
  2375. EOSC
  2376.  
  2377. : function used to set $1 to $val
  2378. setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
  2379. case "$val$was" in
  2380. $define$undef) . ./whoa; eval "$var=\$td";;
  2381. $undef$define) . ./whoa; eval "$var=\$tu";;
  2382. *) eval "$var=$val";;
  2383. esac'
  2384.  
  2385. cat <<EOM
  2386.  
  2387. Perl can be built to take advantage of threads, on some systems.
  2388. To do so, Configure must be run with -Dusethreads.
  2389. (See README.threads for details.)
  2390. EOM
  2391. case "$usethreads" in
  2392. $define|true|[yY]*)    dflt='y';;
  2393. *) dflt='n';;
  2394. esac
  2395. rp='Build a threading Perl?'
  2396. . ./myread
  2397. case "$ans" in
  2398. y|Y)    val="$define" ;;     
  2399. *)      val="$undef" ;;
  2400. esac
  2401. set usethreads
  2402. eval $setvar 
  2403. : Look for a hint-file generated 'call-back-unit'.  Now that the
  2404. : user has specified if a threading perl is to be built, we may need 
  2405. : to set or change some other defaults.
  2406. if $test -f usethreads.cbu; then
  2407.     . ./usethreads.cbu
  2408. fi
  2409. case "$d_oldpthreads" in
  2410. '')    : Configure tests would be welcome here.  For now, assume undef.
  2411.     val="$undef" ;;
  2412. *)    val="$d_oldpthreads" ;;
  2413. esac
  2414. set d_oldpthreads
  2415. eval $setvar
  2416.  
  2417. : determine the architecture name
  2418. echo " "
  2419. if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
  2420.     tarch=`arch`"-$osname"
  2421. elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
  2422.     if uname -m > tmparch 2>&1 ; then
  2423.         tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
  2424.             -e 's/$/'"-$osname/" tmparch`
  2425.     else
  2426.         tarch="$osname"
  2427.     fi
  2428.     $rm -f tmparch
  2429. else
  2430.     tarch="$osname"
  2431. fi
  2432. case "$myarchname" in
  2433. ''|"$tarch") ;;
  2434. *)
  2435.     echo "(Your architecture name used to be $myarchname.)"
  2436.     archname=''
  2437.     ;;
  2438. esac
  2439. case "$archname" in
  2440. '') dflt="$tarch";;
  2441. *) dflt="$archname";;
  2442. esac
  2443. rp='What is your architecture name'
  2444. . ./myread
  2445. case "$usethreads" in
  2446. $define)  echo "Threads selected." >&4
  2447.           case "$ans" in
  2448.           *-thread) echo "...and architecture name already ends in -thread." >&4
  2449.                     archname="$ans"
  2450.                     ;;
  2451.           *)        archname="$ans-thread"
  2452.                     echo "...setting architecture name to $archname." >&4
  2453.                     ;;
  2454.           esac
  2455.           ;;
  2456. *)        archname="$ans" ;;
  2457. esac
  2458. myarchname="$tarch"
  2459. : is AFS running?
  2460. echo " "
  2461. case "$afs" in
  2462. $define|true)    afs=true ;;
  2463. $undef|false)    afs=false ;;
  2464. *)    if test -d /afs; then
  2465.         afs=true
  2466.     else
  2467.         afs=false
  2468.     fi
  2469.     ;;
  2470. esac
  2471. if $afs; then
  2472.     echo "AFS may be running... I'll be extra cautious then..." >&4
  2473. else
  2474.     echo "AFS does not seem to be running..." >&4
  2475. fi
  2476.  
  2477. : decide how portable to be.  Allow command line overrides.
  2478. case "$d_portable" in
  2479. "$undef") ;;
  2480. *)    d_portable="$define" ;;
  2481. esac
  2482.  
  2483. : set up shell script to do ~ expansion
  2484. cat >filexp <<EOSS
  2485. $startsh
  2486. : expand filename
  2487. case "\$1" in
  2488.  ~/*|~)
  2489.     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
  2490.     ;;
  2491.  ~*)
  2492.     if $test -f /bin/csh; then
  2493.         /bin/csh -f -c "glob \$1"
  2494.         failed=\$?
  2495.         echo ""
  2496.         exit \$failed
  2497.     else
  2498.         name=\`$expr x\$1 : '..\([^/]*\)'\`
  2499.         dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
  2500.         if $test ! -d "\$dir"; then
  2501.             me=\`basename \$0\`
  2502.             echo "\$me: can't locate home directory for: \$name" >&2
  2503.             exit 1
  2504.         fi
  2505.         case "\$1" in
  2506.         */*)
  2507.             echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
  2508.             ;;
  2509.         *)
  2510.             echo \$dir
  2511.             ;;
  2512.         esac
  2513.     fi
  2514.     ;;
  2515. *)
  2516.     echo \$1
  2517.     ;;
  2518. esac
  2519. EOSS
  2520. chmod +x filexp
  2521. $eunicefix filexp
  2522.  
  2523. : now set up to get a file name
  2524. cat <<EOS >getfile
  2525. $startsh
  2526. EOS
  2527. cat <<'EOSC' >>getfile
  2528. tilde=''
  2529. fullpath=''
  2530. already=''
  2531. skip=''
  2532. none_ok=''
  2533. exp_file=''
  2534. nopath_ok=''
  2535. orig_rp="$rp"
  2536. orig_dflt="$dflt"
  2537.  
  2538. case "$fn" in
  2539. *\(*)
  2540.     expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
  2541.     fn=`echo $fn | sed 's/(.*)//'`
  2542.     ;;
  2543. esac
  2544.  
  2545. case "$fn" in
  2546. *:*)
  2547.     loc_file=`expr $fn : '.*:\(.*\)'`
  2548.     fn=`expr $fn : '\(.*\):.*'`
  2549.     ;;
  2550. esac
  2551.  
  2552. case "$fn" in
  2553. *~*) tilde=true;;
  2554. esac
  2555. case "$fn" in
  2556. */*) fullpath=true;;
  2557. esac
  2558. case "$fn" in
  2559. *+*) skip=true;;
  2560. esac
  2561. case "$fn" in
  2562. *n*) none_ok=true;;
  2563. esac
  2564. case "$fn" in
  2565. *e*) exp_file=true;;
  2566. esac
  2567. case "$fn" in
  2568. *p*) nopath_ok=true;;
  2569. esac
  2570.  
  2571. case "$fn" in
  2572. *f*) type='File';;
  2573. *d*) type='Directory';;
  2574. *l*) type='Locate';;
  2575. esac
  2576.  
  2577. what="$type"
  2578. case "$what" in
  2579. Locate) what='File';;
  2580. esac
  2581.  
  2582. case "$exp_file" in
  2583. '')
  2584.     case "$d_portable" in
  2585.     "$define") ;;
  2586.     *) exp_file=true;;
  2587.     esac
  2588.     ;;
  2589. esac
  2590.  
  2591. cd ..
  2592. while test "$type"; do
  2593.     redo=''
  2594.     rp="$orig_rp"
  2595.     dflt="$orig_dflt"
  2596.     case "$tilde" in
  2597.     true) rp="$rp (~name ok)";;
  2598.     esac
  2599.     . UU/myread
  2600.     if test -f UU/getfile.ok && \
  2601.         $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
  2602.     then
  2603.         value="$ans"
  2604.         ansexp="$ans"
  2605.         break
  2606.     fi
  2607.     case "$ans" in
  2608.     none)
  2609.         value=''
  2610.         ansexp=''
  2611.         case "$none_ok" in
  2612.         true) type='';;
  2613.         esac
  2614.         ;;
  2615.     *)
  2616.         case "$tilde" in
  2617.         '') value="$ans"
  2618.             ansexp="$ans";;
  2619.         *)
  2620.             value=`UU/filexp $ans`
  2621.             case $? in
  2622.             0)
  2623.                 if test "$ans" != "$value"; then
  2624.                     echo "(That expands to $value on this system.)"
  2625.                 fi
  2626.                 ;;
  2627.             *) value="$ans";;
  2628.             esac
  2629.             ansexp="$value"
  2630.             case "$exp_file" in
  2631.             '') value="$ans";;
  2632.             esac
  2633.             ;;
  2634.         esac
  2635.         case "$fullpath" in
  2636.         true)
  2637.             case "$ansexp" in
  2638.             /*) value="$ansexp" ;;
  2639.             *)
  2640.                 redo=true
  2641.                 case "$already" in
  2642.                 true)
  2643.                 echo "I shall only accept a full path name, as in /bin/ls." >&4
  2644.                 echo "Use a ! shell escape if you wish to check pathnames." >&4
  2645.                     ;;
  2646.                 *)
  2647.                 echo "Please give a full path name, starting with slash." >&4
  2648.                     case "$tilde" in
  2649.                     true)
  2650.                 echo "Note that using ~name is ok provided it expands well." >&4
  2651.                         already=true
  2652.                         ;;
  2653.                     esac
  2654.                 esac
  2655.                 ;;
  2656.             esac
  2657.             ;;
  2658.         esac
  2659.         case "$redo" in
  2660.         '')
  2661.             case "$type" in
  2662.             File)
  2663.                 if test -f "$ansexp"; then
  2664.                     type=''
  2665.                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
  2666.                 then
  2667.                     echo "($value is not a plain file, but that's ok.)"
  2668.                     type=''
  2669.                 fi
  2670.                 ;;
  2671.             Directory)
  2672.                 if test -d "$ansexp"; then
  2673.                     type=''
  2674.                 fi
  2675.                 ;;
  2676.             Locate)
  2677.                 if test -d "$ansexp"; then
  2678.                     echo "(Looking for $loc_file in directory $value.)"
  2679.                     value="$value/$loc_file"
  2680.                     ansexp="$ansexp/$loc_file"
  2681.                 fi
  2682.                 if test -f "$ansexp"; then
  2683.                     type=''
  2684.                 fi
  2685.                 case "$nopath_ok" in
  2686.                 true)    case "$value" in
  2687.                     */*) ;;
  2688.                     *)    echo "Assuming $value will be in people's path."
  2689.                         type=''
  2690.                         ;;
  2691.                     esac
  2692.                     ;;
  2693.                 esac
  2694.                 ;;
  2695.             esac
  2696.  
  2697.             case "$skip" in
  2698.             true) type='';
  2699.             esac
  2700.  
  2701.             case "$type" in
  2702.             '') ;;
  2703.             *)
  2704.                 if test "$fastread" = yes; then
  2705.                     dflt=y
  2706.                 else
  2707.                     dflt=n
  2708.                 fi
  2709.                 rp="$what $value doesn't exist.  Use that name anyway?"
  2710.                 . UU/myread
  2711.                 dflt=''
  2712.                 case "$ans" in
  2713.                 y*) type='';;
  2714.                 *) echo " ";;
  2715.                 esac
  2716.                 ;;
  2717.             esac
  2718.             ;;
  2719.         esac
  2720.         ;;
  2721.     esac
  2722. done
  2723. cd UU
  2724. ans="$value"
  2725. rp="$orig_rp"
  2726. dflt="$orig_dflt"
  2727. rm -f getfile.ok
  2728. EOSC
  2729.  
  2730. : determine root of directory hierarchy where package will be installed.
  2731. case "$prefix" in
  2732. '')
  2733.     dflt=`./loc . /usr/local /usr/local /local /opt /usr`
  2734.     ;;
  2735. *)
  2736.     dflt="$prefix"
  2737.     ;;
  2738. esac
  2739. $cat <<EOM
  2740.  
  2741. By default, $package will be installed in $dflt/bin, manual
  2742. pages under $dflt/man, etc..., i.e. with $dflt as prefix for
  2743. all installation directories. Typically set to /usr/local, but you
  2744. may choose /usr if you wish to install $package among your system
  2745. binaries. If you wish to have binaries under /bin but manual pages
  2746. under /usr/local/man, that's ok: you will be prompted separately
  2747. for each of the installation directories, the prefix being only used
  2748. to set the defaults.
  2749.  
  2750. EOM
  2751. fn=d~
  2752. rp='Installation prefix to use?'
  2753. . ./getfile
  2754. oldprefix=''
  2755. case "$prefix" in
  2756. '') ;;
  2757. *)
  2758.     case "$ans" in
  2759.     "$prefix") ;;
  2760.     *) oldprefix="$prefix";;
  2761.     esac
  2762.     ;;
  2763. esac
  2764. prefix="$ans"
  2765. prefixexp="$ansexp"
  2766.  
  2767. : set the prefixit variable, to compute a suitable default value
  2768. prefixit='case "$3" in
  2769. ""|none)
  2770.     case "$oldprefix" in
  2771.     "") eval "$1=\"\$$2\"";;
  2772.     *)
  2773.         case "$3" in
  2774.         "") eval "$1=";;
  2775.         none)
  2776.             eval "tp=\"\$$2\"";
  2777.             case "$tp" in
  2778.             ""|" ") eval "$1=\"\$$2\"";;
  2779.             *) eval "$1=";;
  2780.             esac;;
  2781.         esac;;
  2782.     esac;;
  2783. *)
  2784.     eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
  2785.     case "$tp" in
  2786.     --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
  2787.     /*-$oldprefix/*|\~*-$oldprefix/*)
  2788.         eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
  2789.     *) eval "$1=\"\$$2\"";;
  2790.     esac;;
  2791. esac'
  2792.  
  2793. : set the base revision
  2794. baserev=5.0
  2795.  
  2796. : get the patchlevel
  2797. echo " "
  2798. echo "Getting the current patchlevel..." >&4
  2799. if $test -r $rsrc/patchlevel.h;then
  2800.     patchlevel=`awk '/define[     ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
  2801.     subversion=`awk '/define[     ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
  2802. else
  2803.     patchlevel=0
  2804.     subversion=0
  2805. fi
  2806. $echo $n "(You have $package" $c
  2807. case "$package" in
  2808. "*$baserev")    ;;
  2809. *)        $echo $n " $baserev" $c ;;
  2810. esac
  2811. $echo $n " patchlevel $patchlevel" $c
  2812. test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
  2813. echo ".)"
  2814.  
  2815. if test 0 -eq "$subversion"; then
  2816.     version=`LC_ALL=C; export LC_ALL; \
  2817.          echo $baserev $patchlevel | \
  2818.          $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
  2819. else
  2820.     version=`LC_ALL=C; export LC_ALL; \
  2821.          echo $baserev $patchlevel $subversion | \
  2822.          $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
  2823. fi
  2824. : Figure out perl API version.  Perhaps this should be in patchlevel.h
  2825. if test "$subversion" -lt 50; then
  2826.     apiversion=`LC_ALL=C; export LC_ALL; \
  2827.          echo $baserev $patchlevel | \
  2828.          $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
  2829. else
  2830.     apiversion="$version"
  2831. fi
  2832.  
  2833. : determine where private library files go
  2834. : Usual default is /usr/local/lib/perl5/$version.
  2835. : Also allow things like /opt/perl/lib/$version, since 
  2836. : /opt/perl/lib/perl5... would be redundant.
  2837. case "$prefix" in
  2838. *perl*) set dflt privlib lib/$version ;;
  2839. *)     set dflt privlib lib/$package/$version ;;
  2840. esac
  2841. eval $prefixit
  2842. $cat <<EOM
  2843.  
  2844. There are some auxiliary files for $package that need to be put into a
  2845. private library directory that is accessible by everyone.
  2846.  
  2847. EOM
  2848. fn=d~+
  2849. rp='Pathname where the private library files will reside?'
  2850. . ./getfile
  2851. if $test "X$privlibexp" != "X$ansexp"; then
  2852.     installprivlib=''
  2853. fi
  2854. privlib="$ans"
  2855. privlibexp="$ansexp"
  2856. if $afs; then
  2857.     $cat <<EOM
  2858.  
  2859. Since you are running AFS, I need to distinguish the directory in which
  2860. private files reside from the directory in which they are installed (and from
  2861. which they are presumably copied to the former directory by occult means).
  2862.  
  2863. EOM
  2864.     case "$installprivlib" in
  2865.     '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
  2866.     *) dflt="$installprivlib";;
  2867.     esac
  2868.     fn=de~
  2869.     rp='Where will private files be installed?'
  2870.     . ./getfile
  2871.     installprivlib="$ans"
  2872. else
  2873.     installprivlib="$privlibexp"
  2874. fi
  2875.  
  2876. : set the prefixup variable, to restore leading tilda escape
  2877. prefixup='case "$prefixexp" in
  2878. "$prefix") ;;
  2879. *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
  2880. esac'
  2881.  
  2882. : determine where public architecture dependent libraries go
  2883. set archlib archlib
  2884. eval $prefixit
  2885. : privlib default is /usr/local/lib/$package/$version
  2886. : archlib default is /usr/local/lib/$package/$version/$archname
  2887. : privlib may have an optional trailing /share.
  2888. tdflt=`echo $privlib | $sed 's,/share$,,'`
  2889. tdflt=$tdflt/$archname
  2890. case "$archlib" in
  2891. '')    dflt=$tdflt
  2892.     ;;
  2893. *)    dflt="$archlib"
  2894.     ;;
  2895. esac
  2896. cat <<EOM
  2897.  
  2898. $spackage contains architecture-dependent library files.  If you are
  2899. sharing libraries in a heterogeneous environment, you might store
  2900. these files in a separate location.  Otherwise, you can just include
  2901. them with the rest of the public library files.
  2902.  
  2903. EOM
  2904. fn=d+~
  2905. rp='Where do you want to put the public architecture-dependent libraries?'
  2906. . ./getfile
  2907. archlib="$ans"
  2908. archlibexp="$ansexp"
  2909.  
  2910. if $afs; then
  2911.     $cat <<EOM
  2912.  
  2913. Since you are running AFS, I need to distinguish the directory in
  2914. which architecture-dependent library files reside from the directory
  2915. in which they are installed (and from which they are presumably copied
  2916. to the former directory by occult means).
  2917.  
  2918. EOM
  2919.     case "$installarchlib" in
  2920.     '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
  2921.     *) dflt="$installarchlib";;
  2922.     esac
  2923.     fn=de~
  2924.     rp='Where will architecture-dependent library files be installed?'
  2925.     . ./getfile
  2926.     installarchlib="$ans"
  2927. else
  2928.     installarchlib="$archlibexp"
  2929. fi
  2930. if $test X"$archlib" = X"$privlib"; then
  2931.     d_archlib="$undef"
  2932. else
  2933.     d_archlib="$define"
  2934. fi
  2935.  
  2936. : make some quick guesses about what we are up against
  2937. echo " "
  2938. $echo $n "Hmm...  $c"
  2939. echo exit 1 >bsd
  2940. echo exit 1 >usg
  2941. echo exit 1 >v7
  2942. echo exit 1 >osf1
  2943. echo exit 1 >eunice
  2944. echo exit 1 >xenix
  2945. echo exit 1 >venix
  2946. echo exit 1 >os2
  2947. d_bsd="$undef"
  2948. $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
  2949. if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
  2950. then
  2951.     echo "Looks kind of like an OSF/1 system, but we'll see..."
  2952.     echo exit 0 >osf1
  2953. elif test `echo abc | tr a-z A-Z` = Abc ; then
  2954.     xxx=`./loc addbib blurfl $pth`
  2955.     if $test -f $xxx; then
  2956.     echo "Looks kind of like a USG system with BSD features, but we'll see..."
  2957.         echo exit 0 >bsd
  2958.         echo exit 0 >usg
  2959.     else
  2960.         if $contains SIGTSTP foo >/dev/null 2>&1 ; then
  2961.             echo "Looks kind of like an extended USG system, but we'll see..."
  2962.         else
  2963.             echo "Looks kind of like a USG system, but we'll see..."
  2964.         fi
  2965.         echo exit 0 >usg
  2966.     fi
  2967. elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
  2968.     echo "Looks kind of like a BSD system, but we'll see..."
  2969.     d_bsd="$define"
  2970.     echo exit 0 >bsd
  2971. else
  2972.     echo "Looks kind of like a Version 7 system, but we'll see..."
  2973.     echo exit 0 >v7
  2974. fi
  2975. case "$eunicefix" in
  2976. *unixtovms*)
  2977.     $cat <<'EOI'
  2978. There is, however, a strange, musty smell in the air that reminds me of
  2979. something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
  2980. EOI
  2981.     echo exit 0 >eunice
  2982.     d_eunice="$define"
  2983. : it so happens the Eunice I know will not run shell scripts in Unix format
  2984.     ;;
  2985. *)
  2986.     echo " "
  2987.     echo "Congratulations.  You aren't running Eunice."
  2988.     d_eunice="$undef"
  2989.     ;;
  2990. esac
  2991. : Detect OS2.  The p_ variable is set above in the Head.U unit.
  2992. case "$p_" in
  2993. :) ;;
  2994. *)
  2995.     $cat <<'EOI'
  2996. I have the feeling something is not exactly right, however...don't tell me...
  2997. lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
  2998. EOI
  2999.     echo exit 0 >os2
  3000.     ;;
  3001. esac
  3002. if test -f /xenix; then
  3003.     echo "Actually, this looks more like a XENIX system..."
  3004.     echo exit 0 >xenix
  3005.     d_xenix="$define"
  3006. else
  3007.     echo " "
  3008.     echo "It's not Xenix..."
  3009.     d_xenix="$undef"
  3010. fi
  3011. chmod +x xenix
  3012. $eunicefix xenix
  3013. if test -f /venix; then
  3014.     echo "Actually, this looks more like a VENIX system..."
  3015.     echo exit 0 >venix
  3016. else
  3017.     echo " "
  3018.     if ./xenix; then
  3019.         : null
  3020.     else
  3021.         echo "Nor is it Venix..."
  3022.     fi
  3023. fi
  3024. chmod +x bsd usg v7 osf1 eunice xenix venix os2
  3025. $eunicefix bsd usg v7 osf1 eunice xenix venix os2
  3026. $rm -f foo
  3027.  
  3028. : see if setuid scripts can be secure
  3029. $cat <<EOM
  3030.  
  3031. Some kernels have a bug that prevents setuid #! scripts from being
  3032. secure.  Some sites have disabled setuid #! scripts because of this.
  3033.  
  3034. First let's decide if your kernel supports secure setuid #! scripts.
  3035. (If setuid #! scripts would be secure but have been disabled anyway,
  3036. don't say that they are secure if asked.)
  3037.  
  3038. EOM
  3039.  
  3040. val="$undef"
  3041. if $test -d /dev/fd; then
  3042.     echo "#!$ls" >reflect
  3043.     chmod +x,u+s reflect
  3044.     ./reflect >flect 2>&1
  3045.     if $contains "/dev/fd" flect >/dev/null; then
  3046.         echo "Congratulations, your kernel has secure setuid scripts!" >&4
  3047.         val="$define"
  3048.     else
  3049.         $cat <<EOM
  3050. If you are not sure if they are secure, I can check but I'll need a
  3051. username and password different from the one you are using right now.
  3052. If you don't have such a username or don't want me to test, simply
  3053. enter 'none'.
  3054.  
  3055. EOM
  3056.         rp='Other username to test security of setuid scripts with?'
  3057.         dflt='none'
  3058.         . ./myread
  3059.         case "$ans" in
  3060.         n|none)
  3061.             case "$d_suidsafe" in
  3062.             '')    echo "I'll assume setuid scripts are *not* secure." >&4
  3063.                 dflt=n;;
  3064.             "$undef")
  3065.                 echo "Well, the $hint value is *not* secure." >&4
  3066.                 dflt=n;;
  3067.             *)    echo "Well, the $hint value *is* secure." >&4
  3068.                 dflt=y;;
  3069.             esac
  3070.             ;;
  3071.         *)
  3072.             $rm -f reflect flect
  3073.             echo "#!$ls" >reflect
  3074.             chmod +x,u+s reflect
  3075.             echo >flect
  3076.             chmod a+w flect
  3077.             echo '"su" will (probably) prompt you for '"$ans's password."
  3078.             su $ans -c './reflect >flect'
  3079.             if $contains "/dev/fd" flect >/dev/null; then
  3080.                 echo "Okay, it looks like setuid scripts are secure." >&4
  3081.                 dflt=y
  3082.             else
  3083.                 echo "I don't think setuid scripts are secure." >&4
  3084.                 dflt=n
  3085.             fi
  3086.             ;;
  3087.         esac
  3088.         rp='Does your kernel have *secure* setuid scripts?'
  3089.         . ./myread
  3090.         case "$ans" in
  3091.         [yY]*)    val="$define";;
  3092.         *)    val="$undef";;
  3093.         esac
  3094.     fi
  3095. else
  3096.     echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
  3097.     echo "(That's for file descriptors, not floppy disks.)"
  3098.     val="$undef"
  3099. fi
  3100. set d_suidsafe
  3101. eval $setvar
  3102.  
  3103. $rm -f reflect flect
  3104.  
  3105. : now see if they want to do setuid emulation
  3106. echo " "
  3107. val="$undef"
  3108. case "$d_suidsafe" in
  3109. "$define")
  3110.     val="$undef"
  3111.     echo "No need to emulate SUID scripts since they are secure here." >& 4
  3112.     ;;
  3113. *)
  3114.     $cat <<EOM
  3115. Some systems have disabled setuid scripts, especially systems where
  3116. setuid scripts cannot be secure.  On systems where setuid scripts have
  3117. been disabled, the setuid/setgid bits on scripts are currently
  3118. useless.  It is possible for $package to detect those bits and emulate
  3119. setuid/setgid in a secure fashion.  This emulation will only work if
  3120. setuid scripts have been disabled in your kernel.
  3121.  
  3122. EOM
  3123.     case "$d_dosuid" in
  3124.     "$define") dflt=y ;;
  3125.     *) dflt=n ;;
  3126.     esac
  3127.     rp="Do you want to do setuid/setgid emulation?"
  3128.     . ./myread
  3129.     case "$ans" in
  3130.     [yY]*)    val="$define";;
  3131.     *)    val="$undef";;
  3132.     esac
  3133.     ;;
  3134. esac
  3135. set d_dosuid
  3136. eval $setvar
  3137.  
  3138. : determine where manual pages are on this system
  3139. echo " "
  3140. case "$sysman" in
  3141. '') 
  3142.     syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
  3143.     syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
  3144.     syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
  3145.     syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
  3146.     syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
  3147.     sysman=`./loc . /usr/man/man1 $syspath`
  3148.     ;;
  3149. esac
  3150. if $test -d "$sysman"; then
  3151.     echo "System manual is in $sysman." >&4
  3152. else
  3153.     echo "Could not find manual pages in source form." >&4
  3154. fi
  3155.  
  3156. : see what memory models we can support
  3157. case "$models" in
  3158. '')
  3159.     $cat >pdp11.c <<'EOP'
  3160. main() {
  3161. #ifdef pdp11
  3162.     exit(0);
  3163. #else
  3164.     exit(1);
  3165. #endif
  3166. }
  3167. EOP
  3168.     ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
  3169.     if $test -f pdp11 && ./pdp11 2>/dev/null; then
  3170.         dflt='unsplit split'
  3171.     else
  3172.         tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
  3173.         case "$tans" in
  3174.         X) dflt='none';;
  3175.         *) if $test -d /lib/small || $test -d /usr/lib/small; then
  3176.                 dflt='small'
  3177.             else
  3178.                 dflt=''
  3179.             fi
  3180.             if $test -d /lib/medium || $test -d /usr/lib/medium; then
  3181.                 dflt="$dflt medium"
  3182.             fi
  3183.             if $test -d /lib/large || $test -d /usr/lib/large; then
  3184.                 dflt="$dflt large"
  3185.             fi
  3186.             if $test -d /lib/huge || $test -d /usr/lib/huge; then
  3187.                 dflt="$dflt huge"
  3188.             fi
  3189.         esac
  3190.     fi;;
  3191. *) dflt="$models";;
  3192. esac
  3193. $cat <<EOM
  3194.  
  3195. Some systems have different model sizes.  On most systems they are called
  3196. small, medium, large, and huge.  On the PDP11 they are called unsplit and
  3197. split.  If your system doesn't support different memory models, say "none".
  3198. If you wish to force everything to one memory model, say "none" here and
  3199. put the appropriate flags later when it asks you for other cc and ld flags.
  3200. Venix systems may wish to put "none" and let the compiler figure things out.
  3201. (In the following question multiple model names should be space separated.)
  3202.  
  3203. The default for most systems is "none".
  3204.  
  3205. EOM
  3206. rp="Which memory models are supported?"
  3207. . ./myread
  3208. models="$ans"
  3209.  
  3210. case "$models" in
  3211. none)
  3212.     small=''
  3213.     medium=''
  3214.     large=''
  3215.     huge=''
  3216.     unsplit=''
  3217.     split=''
  3218.     ;;
  3219. *split)
  3220.     case "$split" in
  3221.     '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
  3222.              $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
  3223.             dflt='-i'
  3224.         else
  3225.             dflt='none'
  3226.         fi;;
  3227.     *) dflt="$split";;
  3228.     esac
  3229.     rp="What flag indicates separate I and D space?"
  3230.     . ./myread
  3231.     tans="$ans"
  3232.     case "$tans" in
  3233.     none) tans='';;
  3234.     esac
  3235.     split="$tans"
  3236.     unsplit='';;
  3237. *large*|*small*|*medium*|*huge*)
  3238.     case "$models" in
  3239.     *large*)
  3240.         case "$large" in
  3241.         '') dflt='-Ml';;
  3242.         *) dflt="$large";;
  3243.         esac
  3244.     rp="What flag indicates large model?"
  3245.     . ./myread
  3246.     tans="$ans"
  3247.     case "$tans" in
  3248.     none) tans='';
  3249.     esac
  3250.     large="$tans";;
  3251.     *) large='';;
  3252.     esac
  3253.     case "$models" in
  3254.     *huge*) case "$huge" in
  3255.         '') dflt='-Mh';;
  3256.         *) dflt="$huge";;
  3257.         esac
  3258.         rp="What flag indicates huge model?"
  3259.         . ./myread
  3260.         tans="$ans"
  3261.         case "$tans" in
  3262.         none) tans='';
  3263.         esac
  3264.         huge="$tans";;
  3265.     *) huge="$large";;
  3266.     esac
  3267.     case "$models" in
  3268.     *medium*) case "$medium" in
  3269.         '') dflt='-Mm';;
  3270.         *) dflt="$medium";;
  3271.         esac
  3272.         rp="What flag indicates medium model?"
  3273.         . ./myread
  3274.         tans="$ans"
  3275.         case "$tans" in
  3276.         none) tans='';
  3277.         esac
  3278.         medium="$tans";;
  3279.     *) medium="$large";;
  3280.     esac
  3281.     case "$models" in
  3282.     *small*) case "$small" in
  3283.         '') dflt='none';;
  3284.         *) dflt="$small";;
  3285.         esac
  3286.         rp="What flag indicates small model?"
  3287.         . ./myread
  3288.         tans="$ans"
  3289.         case "$tans" in
  3290.         none) tans='';
  3291.         esac
  3292.         small="$tans";;
  3293.     *) small='';;
  3294.     esac
  3295.     ;;
  3296. *)
  3297.     echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
  3298.     ;;
  3299. esac
  3300. $rm -f pdp11.* pdp11
  3301.  
  3302. : see if we need a special compiler
  3303. echo " "
  3304. if ./usg; then
  3305.     case "$cc" in
  3306.     '') case "$Mcc" in
  3307.         /*) dflt='Mcc';;
  3308.         *) case "$large" in
  3309.             -M*) dflt='cc';;
  3310.             *)    if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
  3311.                     if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
  3312.                         dflt='cc'
  3313.                     else
  3314.                         dflt='cc -M'
  3315.                     fi
  3316.                 else
  3317.                     dflt='cc'
  3318.                 fi;;
  3319.             esac;;
  3320.         esac;;
  3321.     *)  dflt="$cc";;
  3322.     esac
  3323.     case "$dflt" in
  3324.     *M*)    $cat <<'EOM'
  3325. On some older systems the default C compiler will not resolve multiple global
  3326. references that happen to have the same name.  On some such systems the "Mcc"
  3327. command may be used to force these to be resolved.  On other systems a "cc -M"
  3328. command is required.  (Note that the -M flag on other systems indicates a
  3329. memory model to use!) If you have the Gnu C compiler, you might wish to use
  3330. that instead.
  3331.  
  3332. EOM
  3333.     ;;
  3334.     esac
  3335.     rp="Use which C compiler?"
  3336.     . ./myread
  3337.     cc="$ans"
  3338. else
  3339.     case "$cc" in
  3340.     '') dflt=cc;;
  3341.     *) dflt="$cc";;
  3342.     esac
  3343.     rp="Use which C compiler?"
  3344.     . ./myread
  3345.     cc="$ans"
  3346. fi
  3347. : Look for a hint-file generated 'call-back-unit'.  Now that the
  3348. : user has specified the compiler, we may need to set or change some
  3349. : other defaults.
  3350. if $test -f cc.cbu; then
  3351.     . ./cc.cbu
  3352. fi
  3353. echo " "
  3354. echo "Checking for GNU cc in disguise and/or its version number..." >&4
  3355. $cat >gccvers.c <<EOM
  3356. #include <stdio.h>
  3357. int main() {
  3358. #ifdef __GNUC__
  3359. #ifdef __VERSION__
  3360.     printf("%s\n", __VERSION__);
  3361. #else
  3362.     printf("%s\n", "1");
  3363. #endif
  3364. #endif
  3365.     exit(0);
  3366. }
  3367. EOM
  3368. if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
  3369.     gccversion=`./gccvers`
  3370.     case "$gccversion" in
  3371.     '') echo "You are not using GNU cc." ;;
  3372.     *)  echo "You are using GNU cc $gccversion." ;;
  3373.     esac
  3374. else
  3375.     echo " "
  3376.     echo "*** WHOA THERE!!! ***" >&4
  3377.     echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
  3378.     case "$knowitall" in
  3379.     '')
  3380.     echo "    You'd better start hunting for one and let me know about it." >&4
  3381.         exit 1
  3382.         ;;
  3383.     esac
  3384. fi
  3385. $rm -f gccvers*
  3386. case "$gccversion" in
  3387. 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
  3388. esac
  3389.  
  3390. : What should the include directory be ?
  3391. echo " "
  3392. $echo $n "Hmm...  $c"
  3393. dflt='/usr/include'
  3394. incpath=''
  3395. mips_type=''
  3396. if $test -f /bin/mips && /bin/mips; then
  3397.     echo "Looks like a MIPS system..."
  3398.     $cat >usr.c <<'EOCP'
  3399. #ifdef SYSTYPE_BSD43
  3400. /bsd43
  3401. #endif
  3402. EOCP
  3403.     if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
  3404.         dflt='/bsd43/usr/include'
  3405.         incpath='/bsd43'
  3406.         mips_type='BSD 4.3'
  3407.     else
  3408.         mips_type='System V'
  3409.     fi
  3410.     $rm -f usr.c usr.out
  3411.     echo "and you're compiling with the $mips_type compiler and libraries."
  3412.     xxx_prompt=y
  3413.     echo "exit 0" >mips
  3414. else
  3415.     echo "Doesn't look like a MIPS system."
  3416.     xxx_prompt=n
  3417.     echo "exit 1" >mips
  3418. fi
  3419. chmod +x mips
  3420. $eunicefix mips
  3421. case "$usrinc" in
  3422. '') ;;
  3423. *) dflt="$usrinc";;
  3424. esac
  3425. case "$xxx_prompt" in
  3426. y)    fn=d/
  3427.     echo " "
  3428.     rp='Where are the include files you want to use?'
  3429.     . ./getfile
  3430.     usrinc="$ans"
  3431.     ;;
  3432. *)    usrinc="$dflt"
  3433.     ;;
  3434. esac
  3435.  
  3436. : see how we invoke the C preprocessor
  3437. echo " "
  3438. echo "Now, how can we feed standard input to your C preprocessor..." >&4
  3439. cat <<'EOT' >testcpp.c
  3440. #define ABC abc
  3441. #define XYZ xyz
  3442. ABC.XYZ
  3443. EOT
  3444. cd ..
  3445. echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
  3446. chmod 755 cppstdin
  3447. wrapper=`pwd`/cppstdin
  3448. ok='false'
  3449. cd UU
  3450.  
  3451. if $test "X$cppstdin" != "X" && \
  3452.     $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
  3453.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  3454. then
  3455.     echo "You used to use $cppstdin $cppminus so we'll use that again."
  3456.     case "$cpprun" in
  3457.     '') echo "But let's see if we can live without a wrapper..." ;;
  3458.     *)
  3459.         if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
  3460.             $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  3461.         then
  3462.             echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
  3463.             ok='true'
  3464.         else
  3465.             echo "(However, $cpprun $cpplast does not work, let's see...)"
  3466.         fi
  3467.         ;;
  3468.     esac
  3469. else
  3470.     case "$cppstdin" in
  3471.     '') ;;
  3472.     *)
  3473.         echo "Good old $cppstdin $cppminus does not seem to be of any help..."
  3474.         ;;
  3475.     esac
  3476. fi
  3477.  
  3478. if $ok; then
  3479.     : nothing
  3480. elif echo 'Maybe "'"$cc"' -E" will work...'; \
  3481.     $cc -E <testcpp.c >testcpp.out 2>&1; \
  3482.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3483.     echo "Yup, it does."
  3484.     x_cpp="$cc -E"
  3485.     x_minus='';
  3486. elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
  3487.     $cc -E - <testcpp.c >testcpp.out 2>&1; \
  3488.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3489.     echo "Yup, it does."
  3490.     x_cpp="$cc -E"
  3491.     x_minus='-';
  3492. elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
  3493.     $cc -P <testcpp.c >testcpp.out 2>&1; \
  3494.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3495.     echo "Yipee, that works!"
  3496.     x_cpp="$cc -P"
  3497.     x_minus='';
  3498. elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
  3499.     $cc -P - <testcpp.c >testcpp.out 2>&1; \
  3500.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3501.     echo "At long last!"
  3502.     x_cpp="$cc -P"
  3503.     x_minus='-';
  3504. elif echo 'No such luck, maybe "'$cpp'" will work...'; \
  3505.     $cpp <testcpp.c >testcpp.out 2>&1; \
  3506.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3507.     echo "It works!"
  3508.     x_cpp="$cpp"
  3509.     x_minus='';
  3510. elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
  3511.     $cpp - <testcpp.c >testcpp.out 2>&1; \
  3512.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3513.     echo "Hooray, it works!  I was beginning to wonder."
  3514.     x_cpp="$cpp"
  3515.     x_minus='-';
  3516. elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
  3517.     $wrapper <testcpp.c >testcpp.out 2>&1; \
  3518.     $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3519.     x_cpp="$wrapper"
  3520.     x_minus=''
  3521.     echo "Eureka!"
  3522. else
  3523.     dflt=''
  3524.     rp="No dice.  I can't find a C preprocessor.  Name one:"
  3525.     . ./myread
  3526.     x_cpp="$ans"
  3527.     x_minus=''
  3528.     $x_cpp <testcpp.c >testcpp.out 2>&1
  3529.     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
  3530.         echo "OK, that will do." >&4
  3531.     else
  3532. echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
  3533.         exit 1
  3534.     fi
  3535. fi
  3536.  
  3537. case "$ok" in
  3538. false)
  3539.     cppstdin="$x_cpp"
  3540.     cppminus="$x_minus"
  3541.     cpprun="$x_cpp"
  3542.     cpplast="$x_minus"
  3543.     set X $x_cpp
  3544.     shift
  3545.     case "$1" in
  3546.     "$cpp")
  3547.         echo "Perhaps can we force $cc -E using a wrapper..."
  3548.         if $wrapper <testcpp.c >testcpp.out 2>&1; \
  3549.             $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
  3550.         then
  3551.             echo "Yup, we can."
  3552.             cppstdin="$wrapper"
  3553.             cppminus='';
  3554.         else
  3555.             echo "Nope, we'll have to live without it..."
  3556.         fi
  3557.         ;;
  3558.     esac
  3559.     case "$cpprun" in
  3560.     "$wrapper")
  3561.         cpprun=''
  3562.         cpplast=''
  3563.         ;;
  3564.     esac
  3565.     ;;
  3566. esac
  3567.  
  3568. case "$cppstdin" in
  3569. "$wrapper") ;;
  3570. *) $rm -f $wrapper;;
  3571. esac
  3572. $rm -f testcpp.c testcpp.out
  3573.  
  3574. : Set private lib path
  3575. case "$plibpth" in
  3576. '') if ./mips; then
  3577.         plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
  3578.     fi;;
  3579. esac
  3580. case "$libpth" in
  3581. ' ') dlist='';;
  3582. '') dlist="$loclibpth $plibpth $glibpth";;
  3583. *) dlist="$libpth";;
  3584. esac
  3585.  
  3586. : Now check and see which directories actually exist, avoiding duplicates
  3587. libpth=''
  3588. for xxx in $dlist
  3589. do
  3590.     if $test -d $xxx; then
  3591.         case " $libpth " in
  3592.         *" $xxx "*) ;;
  3593.         *) libpth="$libpth $xxx";;
  3594.         esac
  3595.     fi
  3596. done
  3597. $cat <<'EOM'
  3598.  
  3599. Some systems have incompatible or broken versions of libraries.  Among
  3600. the directories listed in the question below, please remove any you
  3601. know not to be holding relevant libraries, and add any that are needed.
  3602. Say "none" for none.
  3603.  
  3604. EOM
  3605. case "$libpth" in
  3606. '') dflt='none';;
  3607. *)
  3608.     set X $libpth
  3609.     shift
  3610.     dflt=${1+"$@"}
  3611.     ;;
  3612. esac
  3613. rp="Directories to use for library searches?"
  3614. . ./myread
  3615. case "$ans" in
  3616. none) libpth=' ';;
  3617. *) libpth="$ans";;
  3618. esac
  3619.  
  3620. : compute shared library extension
  3621. case "$so" in
  3622. '')
  3623.     if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
  3624.         dflt='sl'
  3625.     else
  3626.         dflt='so'
  3627.     fi
  3628.     ;;
  3629. *) dflt="$so";;
  3630. esac
  3631. $cat <<EOM
  3632.  
  3633. On some systems, shared libraries may be available.  Answer 'none' if
  3634. you want to suppress searching of shared libraries for the remaining
  3635. of this configuration.
  3636.  
  3637. EOM
  3638. rp='What is the file extension used for shared libraries?'
  3639. . ./myread
  3640. so="$ans"
  3641.  
  3642. : Define several unixisms.
  3643. : Hints files or command line option can be used to override them.
  3644. : The convoluted testing is in case hints files set either the old
  3645. : or the new name.
  3646. case "$_exe" in
  3647. '')    case "$exe_ext" in
  3648.     '')    ;;
  3649.     *)    _exe="$exe_ext" ;;
  3650.     esac
  3651.     ;;
  3652. esac
  3653. case "$_a" in
  3654. '')    case "$lib_ext" in
  3655.     '')    _a='.a';;
  3656.     *)    _a="$lib_ext" ;;
  3657.     esac
  3658.     ;;
  3659. esac
  3660. case "$_o" in
  3661. '') case "$obj_ext" in
  3662.     '')    _o='.o';;
  3663.     *)    _o="$obj_ext";;
  3664.     esac
  3665.     ;;
  3666. esac
  3667. case "$p_" in
  3668. '') case "$path_sep" in
  3669.     '')    p_=':';;
  3670.     *)    p_="$path_sep";;
  3671.     esac
  3672.     ;;
  3673. esac
  3674. exe_ext=$_exe
  3675. lib_ext=$_a
  3676. obj_ext=$_o
  3677. path_sep=$p_
  3678.  
  3679. : Which makefile gets called first.  This is used by make depend.
  3680. case "$firstmakefile" in
  3681. '') firstmakefile='makefile';;
  3682. esac
  3683.  
  3684. : Looking for optional libraries
  3685. echo " "
  3686. echo "Checking for optional libraries..." >&4
  3687. case "$libs" in
  3688. ' '|'') dflt='';;
  3689. *) dflt="$libs";;
  3690. esac
  3691. case "$libswanted" in
  3692. '') libswanted='c_s';;
  3693. esac
  3694. for thislib in $libswanted; do
  3695.     
  3696.     if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
  3697.         echo "Found -l$thislib (shared)."
  3698.         case " $dflt " in
  3699.         *"-l$thislib "*);;
  3700.         *) dflt="$dflt -l$thislib";;
  3701.         esac
  3702.     elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
  3703.         echo "Found -l$thislib (shared)."
  3704.         case " $dflt " in
  3705.         *"-l$thislib "*);;
  3706.         *) dflt="$dflt -l$thislib";;
  3707.         esac
  3708.     elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
  3709.         echo "Found -l$thislib."
  3710.         case " $dflt " in
  3711.         *"-l$thislib "*);;
  3712.         *) dflt="$dflt -l$thislib";;
  3713.         esac
  3714.     elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
  3715.         echo "Found -l$thislib."
  3716.         case " $dflt " in
  3717.         *"-l$thislib "*);;
  3718.         *) dflt="$dflt -l$thislib";;
  3719.         esac
  3720.     elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
  3721.         echo "Found -l${thislib}_s."
  3722.         case " $dflt " in
  3723.         *"-l$thislib "*);;
  3724.         *) dflt="$dflt -l${thislib}_s";;
  3725.         esac
  3726.     elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
  3727.         echo "Found -l$thislib."
  3728.         case " $dflt " in
  3729.         *"-l$thislib "*);;
  3730.         *) dflt="$dflt -l$thislib";;
  3731.         esac
  3732.     else
  3733.         echo "No -l$thislib."
  3734.     fi
  3735. done
  3736. set X $dflt
  3737. shift
  3738. dflt="$*"
  3739. case "$libs" in
  3740. '') dflt="$dflt";;
  3741. *) dflt="$libs";;
  3742. esac
  3743. case "$dflt" in
  3744. ' '|'') dflt='none';;
  3745. esac
  3746.  
  3747. $cat <<EOM
  3748.  
  3749. Some versions of Unix support shared libraries, which make executables smaller
  3750. but make load time slightly longer.
  3751.  
  3752. On some systems, mostly System V Release 3's, the shared library is included
  3753. by putting the option "-lc_s" as the last thing on the cc command line when
  3754. linking.  Other systems use shared libraries by default.  There may be other
  3755. libraries needed to compile $package on your machine as well.  If your system
  3756. needs the "-lc_s" option, include it here.  Include any other special libraries
  3757. here as well.  Say "none" for none.
  3758. EOM
  3759.  
  3760. echo " "
  3761. rp="Any additional libraries?"
  3762. . ./myread
  3763. case "$ans" in
  3764. none) libs=' ';;
  3765. *) libs="$ans";;
  3766. esac
  3767.  
  3768. : determine optimize, if desired, or use for debug flag also
  3769. case "$optimize" in
  3770. ' '|$undef) dflt='none';;
  3771. '') dflt='-O';;
  3772. *) dflt="$optimize";;
  3773. esac
  3774. $cat <<EOH
  3775.  
  3776. Some C compilers have problems with their optimizers.  By default, $package
  3777. compiles with the -O flag to use the optimizer.  Alternately, you might want
  3778. to use the symbolic debugger, which uses the -g flag (on traditional Unix
  3779. systems).  Either flag can be specified here.  To use neither flag, specify
  3780. the word "none".
  3781.  
  3782. EOH
  3783. rp="What optimizer/debugger flag should be used?"
  3784. . ./myread
  3785. optimize="$ans"
  3786. case "$optimize" in
  3787. 'none') optimize=" ";;
  3788. esac
  3789.  
  3790. dflt=''
  3791. : We will not override a previous value, but we might want to
  3792. : augment a hint file
  3793. case "$hint" in
  3794. none|recommended)
  3795.     case "$gccversion" in
  3796.     1*) dflt='-fpcc-struct-return' ;;
  3797.     esac
  3798.     case "$optimize" in
  3799.     *-g*) dflt="$dflt -DDEBUGGING";;
  3800.     esac
  3801.     case "$gccversion" in
  3802.     2*) if test -d /etc/conf/kconfig.d &&
  3803.             $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
  3804.         then
  3805.             dflt="$dflt -posix"
  3806.         fi
  3807.         ;;
  3808.     esac
  3809.     ;;
  3810. esac
  3811.  
  3812. case "$mips_type" in
  3813. *BSD*|'') inclwanted="$locincpth $usrinc";;
  3814. *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
  3815. esac
  3816. for thisincl in $inclwanted; do
  3817.     if $test -d $thisincl; then
  3818.         if $test x$thisincl != x$usrinc; then
  3819.             case "$dflt" in
  3820.             *$thisincl*);;
  3821.             *) dflt="$dflt -I$thisincl";;
  3822.             esac
  3823.         fi
  3824.     fi
  3825. done
  3826.  
  3827. inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
  3828.     xxx=true;
  3829. elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
  3830.     xxx=true;
  3831. else
  3832.     xxx=false;
  3833. fi;
  3834. if $xxx; then
  3835.     case "$dflt" in
  3836.     *$2*);;
  3837.     *) dflt="$dflt -D$2";;
  3838.     esac;
  3839. fi'
  3840.  
  3841. if ./osf1; then
  3842.     set signal.h __LANGUAGE_C__; eval $inctest
  3843. else
  3844.     set signal.h LANGUAGE_C; eval $inctest
  3845. fi
  3846.  
  3847. case "$hint" in
  3848. none|recommended) dflt="$ccflags $dflt" ;;
  3849. *) dflt="$ccflags";;
  3850. esac
  3851.  
  3852. case "$dflt" in
  3853. ''|' ') dflt=none;;
  3854. esac
  3855. $cat <<EOH
  3856.  
  3857. Your C compiler may want other flags.  For this question you should include
  3858. -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
  3859. but you should NOT include libraries or ld flags like -lwhatever.  If you
  3860. want $package to honor its debug switch, you should include -DDEBUGGING here.
  3861. Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
  3862.  
  3863. To use no flags, specify the word "none".
  3864.  
  3865. EOH
  3866. set X $dflt
  3867. shift
  3868. dflt=${1+"$@"}
  3869. rp="Any additional cc flags?"
  3870. . ./myread
  3871. case "$ans" in
  3872. none) ccflags='';;
  3873. *) ccflags="$ans";;
  3874. esac
  3875.  
  3876. : the following weeds options from ccflags that are of no interest to cpp
  3877. cppflags="$ccflags"
  3878. case "$gccversion" in
  3879. 1*) cppflags="$cppflags -D__GNUC__"
  3880. esac
  3881. case "$mips_type" in
  3882. '');;
  3883. *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
  3884. esac
  3885. case "$cppflags" in
  3886. '');;
  3887. *)
  3888.     echo " "
  3889.     echo "Let me guess what the preprocessor flags are..." >&4
  3890.     set X $cppflags
  3891.     shift
  3892.     cppflags=''
  3893.     $cat >cpp.c <<'EOM'
  3894. #define BLURFL foo
  3895.  
  3896. BLURFL xx LFRULB
  3897. EOM
  3898.     previous=''
  3899.     for flag in $*
  3900.     do
  3901.         case "$flag" in
  3902.         -*) ftry="$flag";;
  3903.         *) ftry="$previous $flag";;
  3904.         esac
  3905.         if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
  3906.             >cpp1.out 2>/dev/null && \
  3907.             $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
  3908.             >cpp2.out 2>/dev/null && \
  3909.             $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
  3910.             $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
  3911.         then
  3912.             cppflags="$cppflags $ftry"
  3913.             previous=''
  3914.         else
  3915.             previous="$flag"
  3916.         fi
  3917.     done
  3918.     set X $cppflags
  3919.     shift
  3920.     cppflags=${1+"$@"}
  3921.     case "$cppflags" in
  3922.     *-*)  echo "They appear to be: $cppflags";;
  3923.     esac
  3924.     $rm -f cpp.c cpp?.out
  3925.     ;;
  3926. esac
  3927.  
  3928. : flags used in final linking phase
  3929. case "$ldflags" in
  3930. '') if ./venix; then
  3931.         dflt='-i -z'
  3932.     else
  3933.         dflt=''
  3934.     fi
  3935.     case "$ccflags" in
  3936.     *-posix*) dflt="$dflt -posix" ;;
  3937.     esac
  3938.     ;;
  3939. *) dflt="$ldflags";;
  3940. esac
  3941.  
  3942. : Try to guess additional flags to pick up local libraries.
  3943. for thislibdir in $libpth; do
  3944.     case " $loclibpth " in
  3945.     *" $thislibdir "*)
  3946.         case "$dflt " in 
  3947.         *"-L$thislibdir "*) ;;
  3948.         *)  dflt="$dflt -L$thislibdir" ;;
  3949.         esac
  3950.         ;;
  3951.     esac
  3952. done
  3953.  
  3954. case "$dflt" in
  3955. '') dflt='none' ;;
  3956. esac
  3957.  
  3958. $cat <<EOH
  3959.  
  3960. Your C linker may need flags.  For this question you should
  3961. include -L/whatever and any other flags used by the C linker, but you
  3962. should NOT include libraries like -lwhatever.
  3963.  
  3964. Make sure you include the appropriate -L/path flags if your C linker
  3965. does not normally search all of the directories you specified above,
  3966. namely
  3967.     $libpth
  3968. To use no flags, specify the word "none".
  3969.  
  3970. EOH
  3971.  
  3972. rp="Any additional ld flags (NOT including libraries)?"
  3973. . ./myread
  3974. case "$ans" in
  3975. none) ldflags='';;
  3976. *) ldflags="$ans";;
  3977. esac
  3978. rmlist="$rmlist pdp11"
  3979.  
  3980. : coherency check
  3981. echo " "
  3982. echo "Checking your choice of C compiler and flags for coherency..." >&4
  3983. set X $cc $optimize $ccflags -o try $ldflags try.c $libs
  3984. shift
  3985. $cat >try.msg <<EOM
  3986. I've tried to compile and run a simple program with:
  3987.  
  3988.     $*
  3989.     ./try
  3990.  
  3991. and I got the following output:
  3992.  
  3993. EOM
  3994. $cat > try.c <<'EOF'
  3995. #include <stdio.h>
  3996. main() { printf("Ok\n"); exit(0); }
  3997. EOF
  3998. dflt=y
  3999. if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
  4000.     if sh -c './try' >>try.msg 2>&1; then
  4001.         xxx=`./try`
  4002.         case "$xxx" in
  4003.         "Ok") dflt=n ;;
  4004.         *)    echo 'The program compiled OK, but produced no output.' >> try.msg
  4005.             case " $libs " in
  4006.             *" -lsfio "*)
  4007.                 cat >> try.msg <<'EOQS'
  4008. If $libs contains -lsfio, and sfio is mis-configured, then it
  4009. sometimes (apparently) runs and exits with a 0 status, but with no
  4010. output!  It may have to do with sfio's use of _exit vs. exit.
  4011.  
  4012. EOQS
  4013.                 rp="You have a big problem.  Shall I abort Configure"
  4014.                 dflt=y
  4015.                 ;;
  4016.             esac
  4017.             ;;
  4018.         esac
  4019.     else
  4020.         echo "The program compiled OK, but exited with status $?." >>try.msg
  4021.         rp="You have a problem.  Shall I abort Configure"
  4022.         dflt=y
  4023.     fi
  4024. else
  4025.     echo "I can't compile the test program." >>try.msg
  4026.     rp="You have a BIG problem.  Shall I abort Configure"
  4027.     dflt=y
  4028. fi
  4029. case "$dflt" in
  4030. y)
  4031.     $cat try.msg >&4
  4032.     case "$knowitall" in
  4033.     '')
  4034.         echo "(The supplied flags might be incorrect with this C compiler.)"
  4035.         ;;
  4036.     *) dflt=n;;
  4037.     esac
  4038.     echo " "
  4039.     . ./myread
  4040.     case "$ans" in
  4041.     n*|N*) ;;
  4042.     *)    echo "Ok.  Stopping Configure." >&4
  4043.         exit 1
  4044.         ;;
  4045.     esac
  4046.     ;;
  4047. n) echo "OK, that should do.";;
  4048. esac
  4049. $rm -f try try.* core
  4050.  
  4051. : determine filename position in cpp output
  4052. echo " "
  4053. echo "Computing filename position in cpp output for #include directives..." >&4
  4054. echo '#include <stdio.h>' > foo.c
  4055. $cat >fieldn <<EOF
  4056. $startsh
  4057. $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
  4058. $grep '^[     ]*#.*stdio\.h' | \
  4059. while read cline; do
  4060.     pos=1
  4061.     set \$cline
  4062.     while $test \$# -gt 0; do
  4063.         if $test -r \`echo \$1 | $tr -d '"'\`; then
  4064.             echo "\$pos"
  4065.             exit 0
  4066.         fi
  4067.         shift
  4068.         pos=\`expr \$pos + 1\`
  4069.     done
  4070. done
  4071. EOF
  4072. chmod +x fieldn
  4073. fieldn=`./fieldn`
  4074. $rm -f foo.c fieldn
  4075. case $fieldn in
  4076. '') pos='???';;
  4077. 1) pos=first;;
  4078. 2) pos=second;;
  4079. 3) pos=third;;
  4080. *) pos="${fieldn}th";;
  4081. esac
  4082. echo "Your cpp writes the filename in the $pos field of the line."
  4083.  
  4084. : locate header file
  4085. $cat >findhdr <<EOF
  4086. $startsh
  4087. wanted=\$1
  4088. name=''
  4089. if test -f $usrinc/\$wanted; then
  4090.     echo "$usrinc/\$wanted"
  4091.     exit 0
  4092. fi
  4093. awkprg='{ print \$$fieldn }'
  4094. echo "#include <\$wanted>" > foo\$\$.c
  4095. $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
  4096. $grep "^[     ]*#.*\$wanted" | \
  4097. while read cline; do
  4098.     name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
  4099.     case "\$name" in
  4100.     */\$wanted) echo "\$name"; exit 0;;
  4101.     *) name='';;
  4102.     esac;
  4103. done;
  4104. $rm -f foo\$\$.c;
  4105. case "\$name" in
  4106. '') exit 1;;
  4107. esac
  4108. EOF
  4109. chmod +x findhdr
  4110.  
  4111. : define an alternate in-header-list? function
  4112. inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
  4113. cont=true; xxf="echo \"<\$1> found.\" >&4";
  4114. case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
  4115. *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
  4116. esac;
  4117. case $# in 4) instead=instead;; *) instead="at last";; esac;
  4118. while $test "$cont"; do
  4119.     xxx=`./findhdr $1`
  4120.     var=$2; eval "was=\$$2";
  4121.     if $test "$xxx" && $test -r "$xxx";
  4122.     then eval $xxf;
  4123.     eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
  4124.         cont="";
  4125.     else eval $xxnf;
  4126.     eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
  4127.     set $yyy; shift; shift; yyy=$@;
  4128.     case $# in 0) cont="";;
  4129.     2) xxf="echo \"but I found <\$1> $instead.\" >&4";
  4130.         xxnf="echo \"and I did not find <\$1> either.\" >&4";;
  4131.     *) xxf="echo \"but I found <\$1\> instead.\" >&4";
  4132.         xxnf="echo \"there is no <\$1>, ...\" >&4";;
  4133.     esac;
  4134. done;
  4135. while $test "$yyy";
  4136. do set $yyy; var=$2; eval "was=\$$2";
  4137.     eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
  4138.     set $yyy; shift; shift; yyy=$@;
  4139. done'
  4140.  
  4141. : see if this is a malloc.h system
  4142. set malloc.h i_malloc
  4143. eval $inhdr
  4144.  
  4145. : see if stdlib is available
  4146. set stdlib.h i_stdlib
  4147. eval $inhdr
  4148.  
  4149. : determine which malloc to compile in
  4150. echo " "
  4151. case "$usemymalloc" in
  4152. ''|y*|true)    dflt='y' ;;
  4153. n*|false)    dflt='n' ;;
  4154. *)    dflt="$usemymalloc" ;;
  4155. esac
  4156. rp="Do you wish to attempt to use the malloc that comes with $package?"
  4157. . ./myread
  4158. usemymalloc="$ans"
  4159. case "$ans" in
  4160. y*|true)
  4161.     usemymalloc='y'
  4162.     mallocsrc='malloc.c'
  4163.     mallocobj="malloc$_o"
  4164.     d_mymalloc="$define"
  4165.     case "$libs" in
  4166.     *-lmalloc*)
  4167.         : Remove malloc from list of libraries to use
  4168.         echo "Removing unneeded -lmalloc from library list" >&4
  4169.         set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
  4170.         shift
  4171.         libs="$*"
  4172.         echo "libs = $libs" >&4
  4173.         ;;
  4174.     esac
  4175.     ;;
  4176. *)
  4177.     usemymalloc='n'
  4178.     mallocsrc=''
  4179.     mallocobj=''
  4180.     d_mymalloc="$undef"
  4181.     ;;
  4182. esac
  4183.  
  4184. : compute the return types of malloc and free
  4185. echo " "
  4186. $cat >malloc.c <<END
  4187. #$i_malloc I_MALLOC
  4188. #$i_stdlib I_STDLIB
  4189. #include <stdio.h>
  4190. #include <sys/types.h>
  4191. #ifdef I_MALLOC
  4192. #include <malloc.h>
  4193. #endif
  4194. #ifdef I_STDLIB
  4195. #include <stdlib.h>
  4196. #endif
  4197. #ifdef TRY_MALLOC
  4198. void *malloc();
  4199. #endif
  4200. #ifdef TRY_FREE
  4201. void free();
  4202. #endif
  4203. END
  4204. case "$malloctype" in
  4205. '')
  4206.     if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
  4207.         malloctype='void *'
  4208.     else
  4209.         malloctype='char *'
  4210.     fi
  4211.     ;;
  4212. esac
  4213. echo "Your system wants malloc to return '$malloctype', it would seem." >&4
  4214.  
  4215. case "$freetype" in
  4216. '')
  4217.     if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
  4218.         freetype='void'
  4219.     else
  4220.         freetype='int'
  4221.     fi
  4222.     ;;
  4223. esac
  4224. echo "Your system uses $freetype free(), it would seem." >&4
  4225. $rm -f malloc.[co]
  4226. : Cruising for prototypes
  4227. echo " "
  4228. echo "Checking out function prototypes..." >&4
  4229. $cat >prototype.c <<'EOCP'
  4230. main(int argc, char *argv[]) {
  4231.     exit(0);}
  4232. EOCP
  4233. if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
  4234.     echo "Your C compiler appears to support function prototypes."
  4235.     val="$define"
  4236. else
  4237.     echo "Your C compiler doesn't seem to understand function prototypes."
  4238.     val="$undef"
  4239. fi
  4240. set prototype
  4241. eval $setvar
  4242. $rm -f prototype*
  4243.  
  4244. case "$prototype" in
  4245. "$define") ;;
  4246. *)    ansi2knr='ansi2knr'
  4247.     echo " "
  4248.     cat <<EOM >&4
  4249.  
  4250. $me:  FATAL ERROR:
  4251. This version of $package can only be compiled by a compiler that 
  4252. understands function prototypes.  Unfortunately, your C compiler 
  4253.     $cc $ccflags
  4254. doesn't seem to understand them.  Sorry about that.
  4255.  
  4256. If GNU cc is avaiable for your system, perhaps you could try that instead.  
  4257.  
  4258. Eventually, we hope to support building Perl with pre-ANSI compilers.
  4259. If you would like to help in that effort, please contact <perlbug@perl.org>.
  4260.  
  4261. Aborting Configure now.
  4262. EOM
  4263.     exit 2
  4264.     ;;
  4265. esac
  4266.  
  4267. : determine where public executables go
  4268. echo " "
  4269. set dflt bin bin
  4270. eval $prefixit
  4271. fn=d~
  4272. rp='Pathname where the public executables will reside?'
  4273. . ./getfile
  4274. if $test "X$ansexp" != "X$binexp"; then
  4275.     installbin=''
  4276. fi
  4277. bin="$ans"
  4278. binexp="$ansexp"
  4279. if $afs; then
  4280.     $cat <<EOM
  4281.  
  4282. Since you are running AFS, I need to distinguish the directory in which
  4283. executables reside from the directory in which they are installed (and from
  4284. which they are presumably copied to the former directory by occult means).
  4285.  
  4286. EOM
  4287.     case "$installbin" in
  4288.     '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
  4289.     *) dflt="$installbin";;
  4290.     esac
  4291.     fn=de~
  4292.     rp='Where will public executables be installed?'
  4293.     . ./getfile
  4294.     installbin="$ans"
  4295. else
  4296.     installbin="$binexp"
  4297. fi
  4298.  
  4299. : define a shorthand compile call
  4300. compile='
  4301. mc_file=$1;
  4302. shift;
  4303. $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
  4304. : define a shorthand compile call for compilations that should be ok.
  4305. compile_ok='
  4306. mc_file=$1;
  4307. shift;
  4308. $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
  4309.  
  4310. echo " "
  4311. echo "Determining whether or not we are on an EBCDIC system..." >&4
  4312. cat >tebcdic.c <<EOM
  4313. int main()
  4314. {
  4315.   if ('M'==0xd4) return 0;
  4316.   return 1;
  4317. }
  4318. EOM
  4319. val=$undef
  4320. set tebcdic
  4321. if eval $compile_ok; then
  4322.     if ./tebcdic; then
  4323.         echo "You have EBCDIC." >&4
  4324.         val="$define"
  4325.     else
  4326.         echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin." >&4
  4327.     fi
  4328. else
  4329.     echo "I'm unable to compile the test program." >&4
  4330.     echo "I'll asuume ASCII or some ISO Latin." >&4
  4331. fi
  4332. $rm -f tebcdic.c tebcdic
  4333. set ebcdic
  4334. eval $setvar
  4335.  
  4336. echo " "
  4337. echo "Checking for GNU C Library..." >&4
  4338. cat >gnulibc.c <<EOM
  4339. #include <stdio.h>
  4340. int
  4341. main()
  4342. {
  4343. #ifdef __GLIBC__
  4344.     exit(0);
  4345. #else
  4346.     exit(1);
  4347. #endif
  4348. }
  4349. EOM
  4350. set gnulibc
  4351. if eval $compile_ok && ./gnulibc; then
  4352.     val="$define"
  4353.     echo "You are using the GNU C Library"
  4354. else
  4355.     val="$undef"
  4356.     echo "You are not using the GNU C Library"
  4357. fi
  4358. $rm -f gnulibc*
  4359. set d_gnulibc
  4360. eval $setvar
  4361.  
  4362. : see if nm is to be used to determine whether a symbol is defined or not
  4363. case "$usenm" in
  4364. '')
  4365.     dflt=''
  4366.     case "$d_gnulibc" in
  4367.     "$define")
  4368.         echo " "
  4369.         echo "nm probably won't work on the GNU C Library." >&4
  4370.         dflt=n
  4371.         ;;
  4372.     esac
  4373.     case "$dflt" in
  4374.     '') 
  4375.         if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
  4376.             echo " "
  4377.             echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
  4378.             echo "'nm' won't be sufficient on this sytem." >&4
  4379.             dflt=n
  4380.         fi
  4381.         ;;
  4382.     esac
  4383.     case "$dflt" in
  4384.     '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
  4385.         if $test $dflt -gt 20; then
  4386.             dflt=y
  4387.         else
  4388.             dflt=n
  4389.         fi
  4390.         ;;
  4391.     esac
  4392.     ;;
  4393. *)
  4394.     case "$usenm" in
  4395.     true|$define) dflt=y;;
  4396.     *) dflt=n;;
  4397.     esac
  4398.     ;;
  4399. esac
  4400. $cat <<EOM
  4401.  
  4402. I can use $nm to extract the symbols from your C libraries. This
  4403. is a time consuming task which may generate huge output on the disk (up
  4404. to 3 megabytes) but that should make the symbols extraction faster. The
  4405. alternative is to skip the 'nm' extraction part and to compile a small
  4406. test program instead to determine whether each symbol is present. If
  4407. you have a fast C compiler and/or if your 'nm' output cannot be parsed,
  4408. this may be the best solution.
  4409.  
  4410. You probably shouldn't let me use 'nm' if you are using the GNU C Library.
  4411.  
  4412. EOM
  4413. rp="Shall I use $nm to extract C symbols from the libraries?"
  4414. . ./myread
  4415. case "$ans" in
  4416. [Nn]*) usenm=false;;
  4417. *) usenm=true;;
  4418. esac
  4419.  
  4420. runnm=$usenm
  4421. case "$reuseval" in
  4422. true) runnm=false;;
  4423. esac
  4424.  
  4425. : nm options which may be necessary
  4426. case "$nm_opt" in
  4427. '') if $test -f /mach_boot; then
  4428.         nm_opt=''    # Mach
  4429.     elif $test -d /usr/ccs/lib; then
  4430.         nm_opt='-p'    # Solaris (and SunOS?)
  4431.     elif $test -f /dgux; then
  4432.         nm_opt='-p'    # DG-UX
  4433.     elif $test -f /lib64/rld; then
  4434.         nm_opt='-p'    # 64-bit Irix
  4435.     else
  4436.         nm_opt=''
  4437.     fi;;
  4438. esac
  4439.  
  4440. : nm options which may be necessary for shared libraries but illegal
  4441. : for archive libraries.  Thank you, Linux.
  4442. case "$nm_so_opt" in
  4443. '')    case "$myuname" in
  4444.     *linux*)
  4445.         if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
  4446.             nm_so_opt='--dynamic'
  4447.         fi
  4448.         ;;
  4449.     esac
  4450.     ;;
  4451. esac
  4452.  
  4453. case "$runnm" in
  4454. true)
  4455. : get list of predefined functions in a handy place
  4456. echo " "
  4457. case "$libc" in
  4458. '') libc=unknown
  4459.     case "$libs" in
  4460.     *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
  4461.     esac
  4462.     ;;
  4463. esac
  4464. libnames='';
  4465. case "$libs" in
  4466. '') ;;
  4467. *)  for thislib in $libs; do
  4468.     case "$thislib" in
  4469.     -lc|-lc_s)
  4470.         : Handle C library specially below.
  4471.         ;;
  4472.     -l*)
  4473.         thislib=`echo $thislib | $sed -e 's/^-l//'`
  4474.         if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
  4475.             :
  4476.         elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
  4477.             :
  4478.         elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
  4479.             :
  4480.         elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
  4481.             :
  4482.         elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
  4483.             :
  4484.         elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
  4485.             :
  4486.         elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
  4487.             :
  4488.         else
  4489.             try=''
  4490.         fi
  4491.         libnames="$libnames $try"
  4492.         ;;
  4493.     *) libnames="$libnames $thislib" ;;
  4494.     esac
  4495.     done
  4496.     ;;
  4497. esac
  4498. xxx=normal
  4499. case "$libc" in
  4500. unknown)
  4501.     set /lib/libc.$so
  4502.     for xxx in $libpth; do
  4503.         $test -r $1 || set $xxx/libc.$so
  4504.         : The messy sed command sorts on library version numbers.
  4505.         $test -r $1 || \
  4506.             set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
  4507.             tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
  4508.                 h
  4509.                 s/[0-9][0-9]*/0000&/g
  4510.                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
  4511.                 G
  4512.                 s/\n/ /' | \
  4513.              sort | $sed -e 's/^.* //'`
  4514.         eval set \$$#
  4515.     done
  4516.     $test -r $1 || set /usr/ccs/lib/libc.$so
  4517.     $test -r $1 || set /lib/libsys_s$_a
  4518.     ;;
  4519. *)
  4520.     set blurfl
  4521.     ;;
  4522. esac
  4523. if $test -r "$1"; then
  4524.     echo "Your (shared) C library seems to be in $1."
  4525.     libc="$1"
  4526. elif $test -r /lib/libc && $test -r /lib/clib; then
  4527.     echo "Your C library seems to be in both /lib/clib and /lib/libc."
  4528.     xxx=apollo
  4529.     libc='/lib/clib /lib/libc'
  4530.     if $test -r /lib/syslib; then
  4531.         echo "(Your math library is in /lib/syslib.)"
  4532.         libc="$libc /lib/syslib"
  4533.     fi
  4534. elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
  4535.     echo "Your C library seems to be in $libc, as you said before."
  4536. elif $test -r $incpath/usr/lib/libc$_a; then
  4537.     libc=$incpath/usr/lib/libc$_a;
  4538.     echo "Your C library seems to be in $libc.  That's fine."
  4539. elif $test -r /lib/libc$_a; then
  4540.     libc=/lib/libc$_a;
  4541.     echo "Your C library seems to be in $libc.  You're normal."
  4542. else
  4543.     if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
  4544.         :
  4545.     elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
  4546.         libnames="$libnames "`./loc clib blurfl/dyick $libpth`
  4547.     elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
  4548.         :
  4549.     elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
  4550.         :
  4551.     elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
  4552.         :
  4553.     else
  4554.         tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
  4555.     fi
  4556.     if $test -r "$tans"; then
  4557.         echo "Your C library seems to be in $tans, of all places."
  4558.         libc=$tans
  4559.     else
  4560.         libc='blurfl'
  4561.     fi
  4562. fi
  4563. if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
  4564.     dflt="$libc"
  4565.     cat <<EOM
  4566.  
  4567. If the guess above is wrong (which it might be if you're using a strange
  4568. compiler, or your machine supports multiple models), you can override it here.
  4569.  
  4570. EOM
  4571. else
  4572.     dflt=''
  4573.     echo $libpth | tr ' ' $trnl | sort | uniq > libpath
  4574.     cat >&4 <<EOM
  4575. I can't seem to find your C library.  I've looked in the following places:
  4576.  
  4577. EOM
  4578.     $sed 's/^/    /' libpath
  4579.     cat <<EOM
  4580.  
  4581. None of these seems to contain your C library. I need to get its name...
  4582.  
  4583. EOM
  4584. fi
  4585. fn=f
  4586. rp='Where is your C library?'
  4587. . ./getfile
  4588. libc="$ans"
  4589.  
  4590. echo " "
  4591. echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
  4592. set X `cat libnames`
  4593. shift
  4594. xxx=files
  4595. case $# in 1) xxx=file; esac
  4596. echo "Extracting names from the following $xxx for later perusal:" >&4
  4597. echo " "
  4598. $sed 's/^/    /' libnames >&4
  4599. echo " "
  4600. $echo $n "This may take a while...$c" >&4
  4601.  
  4602. for file in $*; do
  4603.     case $file in
  4604.     *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
  4605.     *) $nm $nm_opt $file 2>/dev/null;;
  4606.     esac
  4607. done >libc.tmp
  4608.  
  4609. $echo $n ".$c"
  4610. $grep fprintf libc.tmp > libc.ptf
  4611. xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
  4612. xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
  4613. xxx='[ADTSIW]'
  4614. if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
  4615.     eval $xscan;\
  4616.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4617.         eval $xrun
  4618. elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
  4619.     eval $xscan;\
  4620.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4621.         eval $xrun
  4622. elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
  4623.     eval $xscan;\
  4624.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4625.         eval $xrun
  4626. elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
  4627.     eval $xscan;\
  4628.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4629.         eval $xrun
  4630. elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
  4631.     eval $xscan;\
  4632.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4633.         eval $xrun
  4634. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
  4635.     eval $xscan;\
  4636.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4637.         eval $xrun
  4638. elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
  4639.                 -e '/ file/d' -e 's/^\([^     ]*\).*/\1/p'";\
  4640.     eval $xscan;\
  4641.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4642.         eval $xrun
  4643. elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
  4644.     eval $xscan;\
  4645.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4646.         eval $xrun
  4647. elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
  4648.     eval $xscan;\
  4649.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4650.         eval $xrun
  4651. elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
  4652.     eval $xscan;\
  4653.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4654.         eval $xrun
  4655. elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
  4656.     eval $xscan;\
  4657.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4658.         eval $xrun
  4659. elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
  4660.     eval $xscan;\
  4661.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4662.         eval $xrun
  4663. elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
  4664.     eval $xscan;\
  4665.     $contains '^fprintf$' libc.list >/dev/null 2>&1; then
  4666.         eval $xrun
  4667. else
  4668.     $nm -p $* 2>/dev/null >libc.tmp
  4669.     $grep fprintf libc.tmp > libc.ptf
  4670.     if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
  4671.         eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
  4672.     then
  4673.         nm_opt='-p'
  4674.         eval $xrun
  4675.     else
  4676.         echo " "
  4677.         echo "$nm didn't seem to work right. Trying $ar instead..." >&4
  4678.         com=''
  4679.         if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
  4680.             for thisname in $libnames $libc; do
  4681.                 $ar t $thisname >>libc.tmp
  4682.             done
  4683.             $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
  4684.             echo "Ok." >&4
  4685.         elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
  4686.             # Repeat libc to extract forwarders to DLL entries too
  4687.             for thisname in $libnames $libc; do
  4688.                 $ar tv $thisname >>libc.tmp
  4689.                 # Revision 50 of EMX has bug in $ar.
  4690.                 # it will not extract forwarders to DLL entries
  4691.                 # Use emximp which will extract exactly them.
  4692.                 emximp -o tmp.imp $thisname \
  4693.                     2>/dev/null && \
  4694.                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
  4695.                     < tmp.imp >>libc.tmp
  4696.                 $rm tmp.imp
  4697.             done
  4698.             $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
  4699.             echo "Ok." >&4
  4700.         else
  4701.             echo "$ar didn't seem to work right." >&4
  4702.             echo "Maybe this is a Cray...trying bld instead..." >&4
  4703.             if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
  4704.             then
  4705.                 for thisname in $libnames; do
  4706.                     bld t $libnames | \
  4707.                     $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
  4708.                     $ar t $thisname >>libc.tmp
  4709.                 done
  4710.                 echo "Ok." >&4
  4711.             else
  4712.                 echo "That didn't work either.  Giving up." >&4
  4713.                 exit 1
  4714.             fi
  4715.         fi
  4716.     fi
  4717. fi
  4718. nm_extract="$com"
  4719. if $test -f /lib/syscalls.exp; then
  4720.     echo " "
  4721.     echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
  4722.     $sed -n 's/^\([^     ]*\)[     ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
  4723. fi
  4724. ;;
  4725. esac
  4726. $rm -f libnames libpath
  4727.  
  4728. : see if dld is available
  4729. set dld.h i_dld
  4730. eval $inhdr
  4731.  
  4732. : is a C symbol defined?
  4733. csym='tlook=$1;
  4734. case "$3" in
  4735. -v) tf=libc.tmp; tc=""; tdc="";;
  4736. -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
  4737. *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
  4738. esac;
  4739. tx=yes;
  4740. case "$reuseval-$4" in
  4741. true-) ;;
  4742. true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
  4743. esac;
  4744. case "$tx" in
  4745. yes)
  4746.     case "$runnm" in
  4747.     true)
  4748.         if $contains $tlook $tf >/dev/null 2>&1;
  4749.         then tval=true;
  4750.         else tval=false;
  4751.         fi;;
  4752.     *)
  4753.         echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
  4754.         if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
  4755.         then tval=true;
  4756.         else tval=false;
  4757.         fi;
  4758.         $rm -f t t.c;;
  4759.     esac;;
  4760. *)
  4761.     case "$tval" in
  4762.     $define) tval=true;;
  4763.     *) tval=false;;
  4764.     esac;;
  4765. esac;
  4766. eval "$2=$tval"'
  4767.  
  4768. : define an is-in-libc? function
  4769. inlibc='echo " "; td=$define; tu=$undef;
  4770. sym=$1; var=$2; eval "was=\$$2";
  4771. tx=yes;
  4772. case "$reuseval$was" in
  4773. true) ;;
  4774. true*) tx=no;;
  4775. esac;
  4776. case "$tx" in
  4777. yes)
  4778.     set $sym tres -f;
  4779.     eval $csym;
  4780.     case "$tres" in
  4781.     true)
  4782.         echo "$sym() found." >&4;
  4783.         case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
  4784.     *)
  4785.         echo "$sym() NOT found." >&4;
  4786.         case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
  4787.     esac;;
  4788. *)
  4789.     case "$was" in
  4790.     $define) echo "$sym() found." >&4;;
  4791.     *) echo "$sym() NOT found." >&4;;
  4792.     esac;;
  4793. esac'
  4794.  
  4795. : see if dlopen exists
  4796. xxx_runnm="$runnm"
  4797. runnm=false
  4798. set dlopen d_dlopen
  4799. eval $inlibc
  4800. runnm="$xxx_runnm"
  4801.  
  4802. : determine which dynamic loading, if any, to compile in
  4803. echo " "
  4804. dldir="ext/DynaLoader"
  4805. case "$usedl" in
  4806. $define|y|true)
  4807.     dflt='y'
  4808.     usedl="$define"
  4809.     ;;
  4810. $undef|n|false)
  4811.     dflt='n'
  4812.     usedl="$undef"
  4813.     ;;
  4814. *) 
  4815.     dflt='n'
  4816.     case "$d_dlopen" in
  4817.         $define) dflt='y' ;;
  4818.     esac
  4819.     case "$i_dld" in
  4820.         $define) dflt='y' ;;
  4821.     esac
  4822.     : Does a dl_xxx.xs file exist for this operating system
  4823.     $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
  4824.     ;;
  4825. esac
  4826. rp="Do you wish to use dynamic loading?"
  4827. . ./myread
  4828. usedl="$ans"
  4829. case "$ans" in
  4830. y*) usedl="$define"
  4831.     case "$dlsrc" in
  4832.     '')
  4833.         if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
  4834.             dflt="$dldir/dl_${osname}.xs"
  4835.         elif $test "$d_dlopen" = "$define" ; then
  4836.             dflt="$dldir/dl_dlopen.xs"
  4837.         elif $test "$i_dld" = "$define" ; then
  4838.             dflt="$dldir/dl_dld.xs"
  4839.         else
  4840.             dflt=''
  4841.         fi
  4842.         ;;
  4843.     *)    dflt="$dldir/$dlsrc"
  4844.         ;;
  4845.     esac
  4846.     echo "The following dynamic loading files are available:"
  4847.     : Can not go over to $dldir because getfile has path hard-coded in.
  4848.     tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
  4849.     rp="Source file to use for dynamic loading"
  4850.     fn="fne"
  4851.     # XXX This getfile call will fail the existence check if you try 
  4852.     # building away from $src (this is not supported yet).
  4853.     . ./getfile
  4854.     usedl="$define"
  4855.     : emulate basename
  4856.     dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
  4857.  
  4858.     $cat << EOM
  4859.  
  4860. Some systems may require passing special flags to $cc -c to
  4861. compile modules that will be used to create a shared library.
  4862. To use no flags, say "none".
  4863.  
  4864. EOM
  4865.     case "$cccdlflags" in
  4866.     '')    case "$gccversion" in
  4867.         '') case "$osname" in
  4868.             hpux)    dflt='+z' ;;
  4869.             next)    dflt='none' ;;
  4870.             irix*)    dflt='-KPIC' ;;
  4871.             svr4*|esix*|solaris) dflt='-KPIC' ;;
  4872.             sunos)    dflt='-pic' ;;
  4873.             *)    dflt='none' ;;
  4874.             esac
  4875.             ;;
  4876.         *)  case "$osname" in
  4877.             svr4*|esix*|solaris) dflt='-fPIC' ;;
  4878.             *)    dflt='-fpic' ;;
  4879.             esac ;;
  4880.         esac ;;
  4881.     ' ') dflt='none' ;;
  4882.     *)    dflt="$cccdlflags" ;;
  4883.     esac
  4884.     rp="Any special flags to pass to $cc -c to compile shared library modules?"
  4885.     . ./myread
  4886.     case "$ans" in
  4887.     none) cccdlflags=' ' ;;
  4888.     *) cccdlflags="$ans" ;;
  4889.     esac
  4890.  
  4891.     cat << EOM
  4892.  
  4893. Some systems use ld to create libraries that can be dynamically loaded,
  4894. while other systems (such as those using ELF) use $cc.
  4895.  
  4896. EOM
  4897.     case "$ld" in
  4898.     '')    $cat >try.c <<'EOM'
  4899. /* Test for whether ELF binaries are produced */
  4900. #include <fcntl.h>
  4901. #include <stdlib.h>
  4902. main() {
  4903.     char b[4];
  4904.     int i = open("a.out",O_RDONLY);
  4905.     if(i == -1) 
  4906.         exit(1); /* fail */
  4907.     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
  4908.         exit(0); /* succeed (yes, it's ELF) */
  4909.     else
  4910.         exit(1); /* fail */
  4911. }
  4912. EOM
  4913.         if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
  4914.             cat <<EOM
  4915. You appear to have ELF support.  I'll use $cc to build dynamic libraries.
  4916. EOM
  4917.             dflt="$cc"
  4918.         else
  4919.             echo "I'll use ld to build dynamic libraries."
  4920.             dflt='ld'
  4921.         fi
  4922.         rm -f try.c a.out
  4923.         ;;
  4924.     *)    dflt="$ld"
  4925.         ;;
  4926.     esac
  4927.  
  4928.     rp="What command should be used to create dynamic libraries?"
  4929.     . ./myread
  4930.     ld="$ans"
  4931.  
  4932.     cat << EOM
  4933.  
  4934. Some systems may require passing special flags to $ld to create a
  4935. library that can be dynamically loaded.  If your ld flags include
  4936. -L/other/path options to locate libraries outside your loader's normal
  4937. search path, you may need to specify those -L options here as well.  To
  4938. use no flags, say "none".
  4939.  
  4940. EOM
  4941.     case "$lddlflags" in
  4942.     '') case "$osname" in
  4943.             hpux)  dflt='-b' ;;
  4944.             linux|irix*)    dflt='-shared' ;;
  4945.             next)  dflt='none' ;;
  4946.             solaris) dflt='-G' ;;
  4947.             sunos) dflt='-assert nodefinitions' ;;
  4948.             svr4*|esix*) dflt="-G $ldflags" ;;
  4949.             *)     dflt='none' ;;
  4950.             esac
  4951.             ;;
  4952.     *) dflt="$lddlflags" ;;
  4953.     esac
  4954.  
  4955.     : Try to guess additional flags to pick up local libraries.
  4956.     for thisflag in $ldflags; do
  4957.         case "$thisflag" in
  4958.         -L*)
  4959.             case " $dflt " in
  4960.             *" $thisflag "*) ;;
  4961.             *) dflt="$dflt $thisflag" ;;
  4962.             esac
  4963.             ;;
  4964.         esac
  4965.     done
  4966.  
  4967.     case "$dflt" in
  4968.     ''|' ') dflt='none' ;;
  4969.     esac
  4970.  
  4971.     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
  4972.     . ./myread
  4973.     case "$ans" in
  4974.     none) lddlflags=' ' ;;
  4975.     *) lddlflags="$ans" ;;
  4976.     esac
  4977.  
  4978.     cat <<EOM
  4979.  
  4980. Some systems may require passing special flags to $cc to indicate that
  4981. the resulting executable will use dynamic linking.  To use no flags,
  4982. say "none".
  4983.  
  4984. EOM
  4985.     case "$ccdlflags" in
  4986.     '') case "$osname" in
  4987.         hpux)    dflt='-Wl,-E' ;;
  4988.         linux)    dflt='-rdynamic' ;;
  4989.         next)    dflt='none' ;;
  4990.         sunos)    dflt='none' ;;
  4991.         *)    dflt='none' ;;
  4992.         esac ;;
  4993.     ' ')  dflt='none' ;;
  4994.     *)  dflt="$ccdlflags" ;;
  4995.     esac
  4996.     rp="Any special flags to pass to $cc to use dynamic loading?"
  4997.     . ./myread
  4998.     case "$ans" in
  4999.     none) ccdlflags=' ' ;;
  5000.     *) ccdlflags="$ans" ;;
  5001.     esac
  5002.     ;;
  5003. *)  usedl="$undef"
  5004.     ld='ld'
  5005.     dlsrc='dl_none.xs'
  5006.     lddlflags=''
  5007.     ccdlflags=''
  5008.     ;;
  5009. esac
  5010.  
  5011. also=''
  5012. case "$usedl" in
  5013. $undef)
  5014.     # No dynamic loading being used, so don't bother even to prompt.
  5015.     useshrplib='false'
  5016.     ;;
  5017. *)    case "$useshrplib" in
  5018.     '')    case "$osname" in
  5019.         svr4*|dgux|dynixptx|esix|powerux)
  5020.             dflt=y
  5021.             also='Building a shared libperl is required for dynamic loading to work on your system.'
  5022.             ;;
  5023.         next*)
  5024.             case "$osvers" in
  5025.             4*)    dflt=y
  5026.                 also='Building a shared libperl is needed for MAB support.'
  5027.                 ;;
  5028.             *)    dflt=n
  5029.                 ;;
  5030.             esac
  5031.             ;;
  5032.         *)    dflt=n
  5033.             ;;
  5034.         esac
  5035.         ;;
  5036.     $define|true|[Yy]*)
  5037.         dflt=y
  5038.         ;;
  5039.     *)    dflt=n
  5040.         ;;
  5041.     esac
  5042.     $cat << EOM
  5043.  
  5044. The perl executable is normally obtained by linking perlmain.c with
  5045. libperl${_a}, any static extensions (usually just DynaLoader), and
  5046. any other libraries needed on this system (such as -lm, etc.).  Since
  5047. your system supports dynamic loading, it is probably possible to build
  5048. a shared libperl.$so.  If you will have more than one executable linked
  5049. to libperl.$so, this will significantly reduce the size of each
  5050. executable, but it may have a noticeable affect on performance.  The
  5051. default is probably sensible for your system.
  5052. $also
  5053.  
  5054. EOM
  5055.     rp="Build a shared libperl.$so (y/n)"
  5056.     . ./myread
  5057.     case "$ans" in
  5058.     true|$define|[Yy]*)
  5059.         useshrplib='true'
  5060.         # Why does next4 have to be so different?
  5061.         case "${osname}${osvers}" in
  5062.         next4*)    xxx='DYLD_LIBRARY_PATH' ;;
  5063.         os2*)    xxx='' ;; # Nothing special needed.
  5064.         *)        xxx='LD_LIBRARY_PATH' ;;
  5065.         esac
  5066.         if test X"$xxx" != "X"; then
  5067.             $cat <<EOM  | $tee -a ../config.msg >&4
  5068.  
  5069. To build perl, you must add the current working directory to your
  5070. $xxx environment variable before running make.  You can do
  5071. this with
  5072.    $xxx=\`pwd\`; export $xxx
  5073. for Bourne-style shells, or
  5074.    setenv $xxx \`pwd\`
  5075. for Csh-style shells.  You *MUST* do this before running make.
  5076.  
  5077. EOM
  5078.         fi
  5079.         ;;
  5080.     *)    useshrplib='false' ;;
  5081.     esac
  5082.     ;;
  5083. esac
  5084.  
  5085. case "$useshrplib" in
  5086. true)
  5087.     case "$libperl" in
  5088.     '')
  5089.         # Figure out a good name for libperl.so.  Since it gets stored in
  5090.         # a version-specific architecture-dependent library, the version
  5091.         # number isn't really that important, except for making cc/ld happy.
  5092.         #
  5093.         # A name such as libperl.so.3.1
  5094.         majmin="libperl.$so.$patchlevel.$subversion"
  5095.         # A name such as libperl.so.301
  5096.         majonly=`echo $patchlevel $subversion |
  5097.             $awk '{printf "%d%02d", $1, $2}'`
  5098.         majonly=libperl.$so.$majonly
  5099.         # I'd prefer to keep the os-specific stuff here to a minimum, and
  5100.         # rely on figuring it out from the naming of libc.
  5101.         case "${osname}${osvers}" in
  5102.         next4*)
  5103.             dflt=libperl.5.$so
  5104.             # XXX How handle the --version stuff for MAB?
  5105.             ;;
  5106.         linux*)  # ld won't link with a bare -lperl otherwise.
  5107.             dflt=libperl.$so
  5108.             ;;
  5109.         *)    # Try to guess based on whether libc has major.minor.
  5110.             case "$libc" in
  5111.             *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
  5112.             *libc.$so.[0-9]*) dflt=$majonly ;;
  5113.             *)    dflt=libperl.$so ;;
  5114.             esac
  5115.             ;;
  5116.         esac
  5117.         ;;
  5118.     *)    dflt=$libperl
  5119.         ;;
  5120.     esac
  5121.     cat << EOM
  5122.  
  5123. I need to select a good name for the shared libperl.  If your system uses
  5124. library names with major and minor numbers, then you might want something
  5125. like $majmin.  Alternatively, if your system uses a single version
  5126. number for shared libraries, then you might want to use $majonly.
  5127. Or, your system might be quite happy with a simple libperl.$so.
  5128.  
  5129. Since the shared libperl will get installed into a version-specific
  5130. architecture-dependent directory, the version number of the shared perl
  5131. library probably isn't important, so the default should be o.k.
  5132.  
  5133. EOM
  5134.     rp='What name do you want to give to the shared libperl?'
  5135.     . ./myread
  5136.     libperl=$ans
  5137.     echo "Ok, I'll use $libperl"
  5138.     ;;
  5139. *)
  5140.     libperl="libperl${_a}"
  5141.     ;;
  5142. esac
  5143.  
  5144. # Detect old use of shrpdir via undocumented Configure -Dshrpdir
  5145. case "$shrpdir" in
  5146. '') ;;
  5147. *)    $cat >&4 <<EOM
  5148. WARNING:  Use of the shrpdir variable for the installation location of
  5149. the shared $libperl is not supported.  It was never documented and
  5150. will not work in this version.  Let me (doughera@lafayette.edu)
  5151. know of any problems this may cause.
  5152.  
  5153. EOM
  5154.     case "$shrpdir" in
  5155.     "$archlibexp/CORE")
  5156.         $cat >&4 <<EOM
  5157. But your current setting of $shrpdir is
  5158. the default anyway, so it's harmless.
  5159. EOM
  5160.         ;;
  5161.     *)
  5162.         $cat >&4 <<EOM
  5163. Further, your current attempted setting of $shrpdir
  5164. conflicts with the value of $archlibexp/CORE
  5165. that installperl will use.
  5166. EOM
  5167.         ;;
  5168.     esac
  5169.     ;;
  5170. esac
  5171.  
  5172. # How will the perl executable find the installed shared $libperl?
  5173. # Add $xxx to ccdlflags.
  5174. # If we can't figure out a command-line option, use $shrpenv to
  5175. # set env LD_RUN_PATH.  The main perl makefile uses this.
  5176. shrpdir=$archlibexp/CORE
  5177. xxx=''
  5178. tmp_shrpenv=''
  5179. if "$useshrplib"; then
  5180.     case "$osname" in 
  5181.     aix)
  5182.         # We'll set it in Makefile.SH...
  5183.         ;;
  5184.     solaris|netbsd)
  5185.         xxx="-R $shrpdir"
  5186.         ;;
  5187.     freebsd)
  5188.         xxx="-Wl,-R$shrpdir"
  5189.         ;;
  5190.     linux|irix*|dec_osf)
  5191.         xxx="-Wl,-rpath,$shrpdir"
  5192.         ;;
  5193.     next)
  5194.         # next doesn't like the default...
  5195.         ;;
  5196.     *)
  5197.         tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
  5198.         ;;
  5199.     esac
  5200.     case "$xxx" in
  5201.     '') ;;
  5202.     *)    
  5203.         # Only add $xxx if it isn't already in ccdlflags.
  5204.         case " $ccdlflags " in
  5205.         *" $xxx "*)    ;;
  5206.         *)    ccdlflags="$ccdlflags $xxx"
  5207.             cat <<EOM >&4
  5208.  
  5209. Adding $xxx to the flags
  5210. passed to $ld so that the perl executable will find the 
  5211. installed shared $libperl.
  5212.  
  5213. EOM
  5214.             ;;
  5215.         esac
  5216.         ;;
  5217.     esac
  5218. fi
  5219. # Respect a hint or command-line value.
  5220. case "$shrpenv" in
  5221. '') shrpenv="$tmp_shrpenv" ;;
  5222. esac
  5223.  
  5224. : determine where manual pages go
  5225. set man1dir man1dir none
  5226. eval $prefixit
  5227. $cat <<EOM
  5228.  
  5229. $spackage has manual pages available in source form.
  5230. EOM
  5231. case "$nroff" in
  5232. nroff)
  5233.     echo "However, you don't have nroff, so they're probably useless to you."
  5234.     case "$man1dir" in
  5235.     '') man1dir="none";;
  5236.     esac;;
  5237. esac
  5238. echo "If you don't want the manual sources installed, answer 'none'."
  5239. case "$man1dir" in
  5240. ' ') dflt=none
  5241.     ;;
  5242. '')
  5243.     lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
  5244.     lookpath="$lookpath $prefixexp/man/p_man/man1"
  5245.     lookpath="$lookpath $prefixexp/man/u_man/man1"
  5246.     lookpath="$lookpath $prefixexp/man/man.1"
  5247.     case "$sysman" in
  5248.     */?_man*)    dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
  5249.     *)    dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
  5250.     esac
  5251.     set dflt
  5252.     eval $prefixup
  5253.     ;;
  5254. *)  dflt="$man1dir"
  5255.     ;;
  5256. esac
  5257. echo " "
  5258. fn=dn+~
  5259. rp="Where do the main $spackage manual pages (source) go?"
  5260. . ./getfile
  5261. if $test "X$man1direxp" != "X$ansexp"; then
  5262.     installman1dir=''
  5263. fi
  5264. man1dir="$ans"
  5265. man1direxp="$ansexp"
  5266. case "$man1dir" in
  5267. '') man1dir=' '
  5268.     installman1dir='';;
  5269. esac
  5270. if $afs; then
  5271.     $cat <<EOM
  5272.  
  5273. Since you are running AFS, I need to distinguish the directory in which
  5274. manual pages reside from the directory in which they are installed (and from
  5275. which they are presumably copied to the former directory by occult means).
  5276.  
  5277. EOM
  5278.     case "$installman1dir" in
  5279.     '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
  5280.     *) dflt="$installman1dir";;
  5281.     esac
  5282.     fn=de~
  5283.     rp='Where will man pages be installed?'
  5284.     . ./getfile
  5285.     installman1dir="$ans"
  5286. else
  5287.     installman1dir="$man1direxp"
  5288. fi
  5289.  
  5290. : What suffix to use on installed man pages
  5291.  
  5292. case "$man1dir" in
  5293. ' ')
  5294.     man1ext='0'
  5295.     ;;
  5296. *)
  5297.     rp="What suffix should be used for the main $spackage man pages?"
  5298.     case "$man1ext" in
  5299.     '')    case "$man1dir" in
  5300.         *1)  dflt=1 ;;
  5301.         *1p) dflt=1p ;;
  5302.         *1pm) dflt=1pm ;;
  5303.         *l) dflt=l;;
  5304.         *n) dflt=n;;
  5305.         *o) dflt=o;;
  5306.         *p) dflt=p;;
  5307.         *C) dflt=C;;
  5308.         *L) dflt=L;;
  5309.         *L1) dflt=L1;;
  5310.         *) dflt=1;;
  5311.         esac
  5312.         ;;
  5313.     *)    dflt="$man1ext";;
  5314.     esac
  5315.     . ./myread
  5316.     man1ext="$ans"
  5317.     ;;
  5318. esac
  5319.  
  5320. : see if we can have long filenames
  5321. echo " "
  5322. rmlist="$rmlist /tmp/cf$$"
  5323. $test -d /tmp/cf$$ || mkdir /tmp/cf$$
  5324. first=123456789abcdef
  5325. second=/tmp/cf$$/$first
  5326. $rm -f $first $second
  5327. if (echo hi >$first) 2>/dev/null; then
  5328.     if $test -f 123456789abcde; then
  5329.         echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
  5330.         val="$undef"
  5331.     else
  5332.         if (echo hi >$second) 2>/dev/null; then
  5333.             if $test -f /tmp/cf$$/123456789abcde; then
  5334.                 $cat <<'EOM'
  5335. That's peculiar... You can have filenames longer than 14 characters, but only
  5336. on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
  5337. I shall consider your system cannot support long filenames at all.
  5338. EOM
  5339.                 val="$undef"
  5340.             else
  5341.                 echo 'You can have filenames longer than 14 characters.' >&4
  5342.                 val="$define"
  5343.             fi
  5344.         else
  5345.             $cat <<'EOM'
  5346. How confusing! Some of your filesystems are sane enough to allow filenames
  5347. longer than 14 characters but some others like /tmp can't even think about them.
  5348. So, for now on, I shall assume your kernel does not allow them at all.
  5349. EOM
  5350.             val="$undef"
  5351.         fi
  5352.     fi
  5353. else
  5354.     $cat <<'EOM'
  5355. You can't have filenames longer than 14 chars.  You can't even think about them!
  5356. EOM
  5357.     val="$undef"
  5358. fi 
  5359. set d_flexfnam
  5360. eval $setvar
  5361. $rm -rf /tmp/cf$$ 123456789abcde*
  5362.  
  5363. : determine where library module manual pages go
  5364. set man3dir man3dir none
  5365. eval $prefixit
  5366. $cat <<EOM
  5367.  
  5368. $spackage has manual pages for many of the library modules.
  5369. EOM
  5370.  
  5371. case "$nroff" in
  5372. nroff)
  5373.     $cat <<'EOM'
  5374. However, you don't have nroff, so they're probably useless to you.
  5375. EOM
  5376.     case "$man3dir" in
  5377.     '') man3dir="none";;
  5378.     esac;;
  5379. esac
  5380.  
  5381. case "$d_flexfnam" in
  5382. undef)
  5383.     $cat <<'EOM'
  5384. However, your system can't handle the long file names like File::Basename.3. 
  5385. EOM
  5386.     case "$man3dir" in
  5387.     '') man3dir="none";;
  5388.     esac;;
  5389. esac
  5390.  
  5391. echo "If you don't want the manual sources installed, answer 'none'."
  5392. prog=`echo $package | $sed 's/-*[0-9.]*$//'`
  5393. case "$man3dir" in
  5394. '')    case "$prefix" in 
  5395.     *$prog*) dflt=`echo $man1dir | 
  5396.             $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
  5397.     *)    dflt="$privlib/man/man3" ;;
  5398.     esac
  5399.     ;;
  5400. ' ') dflt=none;;
  5401. *)    dflt="$man3dir" ;;
  5402. esac
  5403. echo " "
  5404.  
  5405. fn=dn+~
  5406. rp="Where do the $package library man pages (source) go?"
  5407. . ./getfile
  5408. if test "X$man3direxp" != "X$ansexp"; then
  5409.     installman3dir=''
  5410. fi
  5411.  
  5412. man3dir="$ans"
  5413. man3direxp="$ansexp"
  5414. case "$man3dir" in
  5415. '') man3dir=' '
  5416.     installman3dir='';;
  5417. esac
  5418. if $afs; then
  5419.     $cat <<EOM
  5420.  
  5421. Since you are running AFS, I need to distinguish the directory in which
  5422. manual pages reside from the directory in which they are installed (and from
  5423. which they are presumably copied to the former directory by occult means).
  5424.  
  5425. EOM
  5426.     case "$installman3dir" in
  5427.     '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
  5428.     *) dflt="$installman3dir";;
  5429.     esac
  5430.     fn=de~
  5431.     rp='Where will man pages be installed?'
  5432.     . ./getfile
  5433.     installman3dir="$ans"
  5434. else
  5435.     installman3dir="$man3direxp"
  5436. fi
  5437.  
  5438. : What suffix to use on installed man pages
  5439.  
  5440. case "$man3dir" in
  5441. ' ')
  5442.     man3ext='0'
  5443.     ;;
  5444. *)
  5445.     rp="What suffix should be used for the $package library man pages?"
  5446.     case "$man3ext" in
  5447.     '')    case "$man3dir" in
  5448.         *3)  dflt=3 ;;
  5449.         *3p) dflt=3p ;;
  5450.         *3pm) dflt=3pm ;;
  5451.         *l) dflt=l;;
  5452.         *n) dflt=n;;
  5453.         *o) dflt=o;;
  5454.         *p) dflt=p;;
  5455.         *C) dflt=C;;
  5456.         *L) dflt=L;;
  5457.         *L3) dflt=L3;;
  5458.         *) dflt=3;;
  5459.         esac
  5460.         ;;
  5461.     *)    dflt="$man3ext";;
  5462.     esac
  5463.     . ./myread
  5464.     man3ext="$ans"
  5465.     ;;
  5466. esac
  5467.  
  5468. : see if we have to deal with yellow pages, now NIS.
  5469. if $test -d /usr/etc/yp || $test -d /etc/yp; then
  5470.     if $test -f /usr/etc/nibindd; then
  5471.         echo " "
  5472.         echo "I'm fairly confident you're on a NeXT."
  5473.         echo " "
  5474.         rp='Do you get the hosts file via NetInfo?'
  5475.         dflt=y
  5476.         case "$hostcat" in
  5477.         nidump*) ;;
  5478.         '') ;;
  5479.         *) dflt=n;;
  5480.         esac
  5481.         . ./myread
  5482.         case "$ans" in
  5483.         y*) hostcat='nidump hosts .';;
  5484.         *)    case "$hostcat" in
  5485.             nidump*) hostcat='';;
  5486.             esac
  5487.             ;;
  5488.         esac
  5489.     fi
  5490.     case "$hostcat" in
  5491.     nidump*) ;;
  5492.     *)
  5493.         case "$hostcat" in
  5494.         *ypcat*) dflt=y;;
  5495.         '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
  5496.                 dflt=y
  5497.             else
  5498.                 dflt=n
  5499.             fi;;
  5500.         *) dflt=n;;
  5501.         esac
  5502.         echo " "
  5503.         rp='Are you getting the hosts file via yellow pages?'
  5504.         . ./myread
  5505.         case "$ans" in
  5506.         y*) hostcat='ypcat hosts';;
  5507.         *) hostcat='cat /etc/hosts';;
  5508.         esac
  5509.         ;;
  5510.     esac
  5511. fi
  5512. case "$hostcat" in
  5513. '') hostcat='cat /etc/hosts';;
  5514. esac
  5515. case "$groupcat" in
  5516. '') groupcat='cat /etc/group';;
  5517. esac
  5518. case "$passcat" in
  5519. '') passcat='cat /etc/passwd';;
  5520. esac
  5521.  
  5522. : now get the host name
  5523. echo " "
  5524. echo "Figuring out host name..." >&4
  5525. case "$myhostname" in
  5526. '') cont=true
  5527.     echo 'Maybe "hostname" will work...'
  5528.     if tans=`sh -c hostname 2>&1` ; then
  5529.         myhostname=$tans
  5530.         phostname=hostname
  5531.         cont=''
  5532.     fi
  5533.     ;;
  5534. *) cont='';;
  5535. esac
  5536. if $test "$cont"; then
  5537.     if ./xenix; then
  5538.         echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
  5539.         if tans=`cat /etc/systemid 2>&1` ; then
  5540.             myhostname=$tans
  5541.             phostname='cat /etc/systemid'
  5542.             echo "Whadyaknow.  Xenix always was a bit strange..."
  5543.             cont=''
  5544.         fi
  5545.     elif $test -r /etc/systemid; then
  5546.         echo "(What is a non-Xenix system doing with /etc/systemid?)"
  5547.     fi
  5548. fi
  5549. if $test "$cont"; then
  5550.     echo 'No, maybe "uuname -l" will work...'
  5551.     if tans=`sh -c 'uuname -l' 2>&1` ; then
  5552.         myhostname=$tans
  5553.         phostname='uuname -l'
  5554.     else
  5555.         echo 'Strange.  Maybe "uname -n" will work...'
  5556.         if tans=`sh -c 'uname -n' 2>&1` ; then
  5557.             myhostname=$tans
  5558.             phostname='uname -n'
  5559.         else
  5560.             echo 'Oh well, maybe I can mine it out of whoami.h...'
  5561.             if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
  5562.                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
  5563.                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
  5564.             else
  5565.                 case "$myhostname" in
  5566.                 '') echo "Does this machine have an identity crisis or something?"
  5567.                     phostname='';;
  5568.                 *)
  5569.                     echo "Well, you said $myhostname before..."
  5570.                     phostname='echo $myhostname';;
  5571.                 esac
  5572.             fi
  5573.         fi
  5574.     fi
  5575. fi
  5576. : you do not want to know about this
  5577. set $myhostname
  5578. myhostname=$1
  5579.  
  5580. : verify guess
  5581. if $test "$myhostname" ; then
  5582.     dflt=y
  5583.     rp='Your host name appears to be "'$myhostname'".'" Right?"
  5584.     . ./myread
  5585.     case "$ans" in
  5586.     y*) ;;
  5587.     *) myhostname='';;
  5588.     esac
  5589. fi
  5590.  
  5591. : bad guess or no guess
  5592. while $test "X$myhostname" = X ; do
  5593.     dflt=''
  5594.     rp="Please type the (one word) name of your host:"
  5595.     . ./myread
  5596.     myhostname="$ans"
  5597. done
  5598.  
  5599. : translate upper to lower if necessary
  5600. case "$myhostname" in
  5601. *[A-Z]*)
  5602.     echo "(Normalizing case in your host name)"
  5603.     myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
  5604.     ;;
  5605. esac
  5606.  
  5607. case "$myhostname" in
  5608. *.*)
  5609.     dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
  5610.     myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
  5611.     echo "(Trimming domain name from host name--host name is now $myhostname)"
  5612.     ;;
  5613. *) case "$mydomain" in
  5614.     '')
  5615.         {
  5616.             test "X$hostcat" = "Xypcat hosts" &&
  5617.             ypmatch "$myhostname" hosts 2>/dev/null |\
  5618.                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
  5619.             $test -s hosts
  5620.         } || {
  5621.                  $hostcat | $sed -n -e "s/[     ]*#.*//; s/\$/ /
  5622.                     /[     ]$myhostname[    . ]/p" > hosts
  5623.         }
  5624.         tmp_re="[    . ]"
  5625.         $test x`$awk "/[0-9].*[     ]$myhostname$tmp_re/ { sum++ }
  5626.                  END { print sum }" hosts` = x1 || tmp_re="[     ]"
  5627.         dflt=.`$awk "/[0-9].*[     ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
  5628.             hosts | $sort | $uniq | \
  5629.             $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
  5630.         case `$echo X$dflt` in
  5631.         X*\ *)    echo "(Several hosts in /etc/hosts matched hostname)"
  5632.             dflt=.
  5633.             ;;
  5634.         X.) echo "(You do not have fully-qualified names in /etc/hosts)"
  5635.             ;;
  5636.         esac
  5637.         case "$dflt" in
  5638.         .)
  5639.             tans=`./loc resolv.conf X /etc /usr/etc`
  5640.             if $test -f "$tans"; then
  5641.                 echo "(Attempting domain name extraction from $tans)"
  5642.                 dflt=.`$sed -n -e 's/    / /g' \
  5643.                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
  5644.                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
  5645.                 case "$dflt" in
  5646.                 .) dflt=.`$sed -n -e 's/    / /g' \
  5647.                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
  5648.                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
  5649.                       ;;
  5650.                 esac
  5651.             fi
  5652.             ;;
  5653.         esac
  5654.         case "$dflt" in
  5655.         .) echo "(No help from resolv.conf either -- attempting clever guess)"
  5656.             dflt=.`sh -c domainname 2>/dev/null`
  5657.             case "$dflt" in
  5658.             '') dflt='.';;
  5659.             .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
  5660.             esac
  5661.             ;;
  5662.         esac
  5663.         case "$dflt" in
  5664.         .) echo "(Lost all hope -- silly guess then)"
  5665.             dflt='.uucp'
  5666.             ;;
  5667.         esac
  5668.         $rm -f hosts
  5669.         ;;
  5670.     *) dflt="$mydomain";;
  5671.     esac;;
  5672. esac
  5673. echo " "
  5674. rp="What is your domain name?"
  5675. . ./myread
  5676. tans="$ans"
  5677. case "$ans" in
  5678. '') ;;
  5679. .*) ;;
  5680. *) tans=".$tans";;
  5681. esac
  5682. mydomain="$tans"
  5683.  
  5684. : translate upper to lower if necessary
  5685. case "$mydomain" in
  5686. *[A-Z]*)
  5687.     echo "(Normalizing case in your domain name)"
  5688.     mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
  5689.     ;;
  5690. esac
  5691.  
  5692. : a little sanity check here
  5693. case "$phostname" in
  5694. '') ;;
  5695. *)
  5696.     case `$phostname | ./tr '[A-Z]' '[a-z]'` in
  5697.     $myhostname$mydomain|$myhostname) ;;
  5698.     *)
  5699.         case "$phostname" in
  5700.         sed*)
  5701.             echo "(That doesn't agree with your whoami.h file, by the way.)"
  5702.             ;;
  5703.         *)
  5704.             echo "(That doesn't agree with your $phostname command, by the way.)"
  5705.             ;;
  5706.         esac
  5707.     ;;
  5708.     esac
  5709.     ;;
  5710. esac
  5711.  
  5712. $cat <<EOM
  5713.  
  5714. I need to get your e-mail address in Internet format if possible, i.e.
  5715. something like user@host.domain. Please answer accurately since I have
  5716. no easy means to double check it. The default value provided below
  5717. is most probably close to the reality but may not be valid from outside
  5718. your organization...
  5719.  
  5720. EOM
  5721. cont=x
  5722. while test "$cont"; do
  5723.     case "$cf_email" in
  5724.     '') dflt="$cf_by@$myhostname$mydomain";;
  5725.     *) dflt="$cf_email";;
  5726.     esac
  5727.     rp='What is your e-mail address?'
  5728.     . ./myread
  5729.     cf_email="$ans"
  5730.     case "$cf_email" in
  5731.     *@*.*) cont='' ;;
  5732.     *)
  5733.         rp='Address does not look like an Internet one.  Use it anyway?'
  5734.         case "$fastread" in
  5735.         yes) dflt=y ;;
  5736.         *) dflt=n ;;
  5737.         esac
  5738.         . ./myread
  5739.         case "$ans" in
  5740.         y*) cont='' ;;
  5741.         *) echo " " ;;
  5742.         esac
  5743.         ;;
  5744.     esac
  5745. done
  5746.  
  5747. $cat <<EOM
  5748.  
  5749. If you or somebody else will be maintaining perl at your site, please
  5750. fill in the correct e-mail address here so that they may be contacted
  5751. if necessary. Currently, the "perlbug" program included with perl
  5752. will send mail to this address in addition to perlbug@perl.com. You may
  5753. enter "none" for no administrator.
  5754.  
  5755. EOM
  5756. case "$perladmin" in
  5757. '') dflt="$cf_email";;
  5758. *) dflt="$perladmin";;
  5759. esac
  5760. rp='Perl administrator e-mail address'
  5761. . ./myread
  5762. perladmin="$ans"
  5763.  
  5764. : figure out how to guarantee perl startup
  5765. case "$startperl" in
  5766. '')
  5767.     case "$sharpbang" in
  5768.     *!)
  5769.         $cat <<EOH
  5770.  
  5771. I can use the #! construct to start perl on your system. This will
  5772. make startup of perl scripts faster, but may cause problems if you
  5773. want to share those scripts and perl is not in a standard place
  5774. ($binexp/perl) on all your platforms. The alternative is to force
  5775. a shell by starting the script with a single ':' character.
  5776.  
  5777. EOH
  5778.         dflt="$binexp/perl"
  5779.         rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
  5780.         . ./myread
  5781.         case "$ans" in
  5782.         none)    startperl=": # use perl";;
  5783.         *)    startperl="#!$ans"
  5784.             if $test 30 -lt `echo "$ans" | wc -c`; then
  5785.                 $cat >&4 <<EOM
  5786.  
  5787. WARNING:  Some systems limit the #! command to 32 characters.
  5788. If you experience difficulty running Perl scripts with #!, try
  5789. installing Perl in a directory with a shorter pathname.
  5790.  
  5791. EOM
  5792.             fi ;;
  5793.         esac
  5794.         ;;
  5795.     *) startperl=": # use perl"
  5796.         ;;
  5797.     esac
  5798.     ;;
  5799. esac
  5800. echo "I'll use $startperl to start perl scripts."
  5801.  
  5802. : figure best path for perl in scripts
  5803. case "$perlpath" in
  5804. '')
  5805.     perlpath="$binexp/perl"
  5806.     case "$startperl" in
  5807.     *!*) ;;
  5808.     *)
  5809.         $cat <<EOH
  5810.  
  5811. I will use the "eval 'exec'" idiom to start Perl on your system.
  5812. I can use the full path of your Perl binary for this purpose, but
  5813. doing so may cause problems if you want to share those scripts and
  5814. Perl is not always in a standard place ($binexp/perl).
  5815.  
  5816. EOH
  5817.         dflt="$binexp/perl"
  5818.         rp="What path shall I use in \"eval 'exec'\"?"
  5819.         . ./myread
  5820.         perlpath="$ans"
  5821.         ;;
  5822.     esac
  5823.     ;;
  5824. esac
  5825. case "$startperl" in
  5826. *!*)    ;;
  5827. *)    echo "I'll use $perlpath in \"eval 'exec'\"" ;;
  5828. esac
  5829.  
  5830. : determine where public executable scripts go
  5831. set scriptdir scriptdir
  5832. eval $prefixit
  5833. case "$scriptdir" in
  5834. '')
  5835.     dflt="$bin"
  5836.     : guess some guesses
  5837.     $test -d /usr/share/scripts && dflt=/usr/share/scripts
  5838.     $test -d /usr/share/bin && dflt=/usr/share/bin
  5839.     $test -d /usr/local/script && dflt=/usr/local/script
  5840.     $test -d $prefixexp/script && dflt=$prefixexp/script
  5841.     set dflt
  5842.     eval $prefixup
  5843.     ;;
  5844. *)  dflt="$scriptdir"
  5845.     ;;
  5846. esac
  5847. $cat <<EOM
  5848.  
  5849. Some installations have a separate directory just for executable scripts so
  5850. that they can mount it across multiple architectures but keep the scripts in
  5851. one spot.  You might, for example, have a subdirectory of /usr/share for this.
  5852. Or you might just lump your scripts in with all your other executables.
  5853.  
  5854. EOM
  5855. fn=d~
  5856. rp='Where do you keep publicly executable scripts?'
  5857. . ./getfile
  5858. if $test "X$ansexp" != "X$scriptdirexp"; then
  5859.     installscript=''
  5860. fi
  5861. scriptdir="$ans"
  5862. scriptdirexp="$ansexp"
  5863. if $afs; then
  5864.     $cat <<EOM
  5865.  
  5866. Since you are running AFS, I need to distinguish the directory in which
  5867. scripts reside from the directory in which they are installed (and from
  5868. which they are presumably copied to the former directory by occult means).
  5869.  
  5870. EOM
  5871.     case "$installscript" in
  5872.     '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
  5873.     *) dflt="$installscript";;
  5874.     esac
  5875.     fn=de~
  5876.     rp='Where will public scripts be installed?'
  5877.     . ./getfile
  5878.     installscript="$ans"
  5879. else
  5880.     installscript="$scriptdirexp"
  5881. fi
  5882.  
  5883. : determine where site specific libraries go.
  5884. : Usual default is /usr/local/lib/perl5/site_perl/$apiversion
  5885. prog=`echo $package | $sed 's/-*[0-9.]*$//'`
  5886. case "$prefix" in
  5887. *perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
  5888. *)     set dflt sitelib lib/$package/site_$prog/$apiversion ;;
  5889. esac
  5890. eval $prefixit
  5891. $cat <<EOM
  5892.  
  5893. The installation process will also create a directory for
  5894. site-specific extensions and modules.  Some users find it convenient
  5895. to place all local files in this directory rather than in the main
  5896. distribution directory.
  5897.  
  5898. EOM
  5899. fn=d~+
  5900. rp='Pathname for the site-specific library files?'
  5901. . ./getfile
  5902. if $test "X$sitelibexp" != "X$ansexp"; then
  5903.     installsitelib=''
  5904. fi
  5905. sitelib="$ans"
  5906. sitelibexp="$ansexp"
  5907. if $afs; then
  5908.     $cat <<EOM
  5909.  
  5910. Since you are running AFS, I need to distinguish the directory in
  5911. which site-specific files reside from the directory in which they are
  5912. installed (and from which they are presumably copied to the former
  5913. directory by occult means).
  5914.  
  5915. EOM
  5916.     case "$installsitelib" in
  5917.     '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
  5918.     *) dflt="$installsitelib";;
  5919.     esac
  5920.     fn=de~
  5921.     rp='Where will site-specific files be installed?'
  5922.     . ./getfile
  5923.     installsitelib="$ans"
  5924. else
  5925.     installsitelib="$sitelibexp"
  5926. fi
  5927.  
  5928. : determine where site specific architecture-dependent libraries go.
  5929. : sitelib  default is /usr/local/lib/perl5/site_perl/$apiversion
  5930. : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
  5931. : sitelib may have an optional trailing /share.
  5932. tdflt=`echo $sitelib | $sed 's,/share$,,'`
  5933. tdflt="$tdflt/$archname"
  5934. set sitearch sitearch none
  5935. eval $prefixit
  5936. case "$sitearch" in
  5937. '')    dflt="$tdflt" ;;
  5938. *)    dflt="$sitearch" ;;
  5939. esac
  5940. $cat <<EOM
  5941.  
  5942. The installation process will also create a directory for
  5943. architecture-dependent site-specific extensions and modules.
  5944.  
  5945. EOM
  5946. fn=nd~+
  5947. rp='Pathname for the site-specific architecture-dependent library files?'
  5948. . ./getfile
  5949. if $test "X$sitearchexp" != "X$ansexp"; then
  5950.     installsitearch=''
  5951. fi
  5952. sitearch="$ans"
  5953. sitearchexp="$ansexp"
  5954. if $afs; then
  5955.     $cat <<EOM
  5956.  
  5957. Since you are running AFS, I need to distinguish the directory in
  5958. which site-specific architecture-dependent library files reside from
  5959. the directory in which they are installed (and from which they are
  5960. presumably copied to the former directory by occult means).
  5961.  
  5962. EOM
  5963.     case "$installsitearch" in
  5964.     '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
  5965.     *) dflt="$installsitearch";;
  5966.     esac
  5967.     fn=de~
  5968.     rp='Where will site-specific architecture-dependent files be installed?'
  5969.     . ./getfile
  5970.     installsitearch="$ans"
  5971. else
  5972.     installsitearch="$sitearchexp"
  5973. fi
  5974.  
  5975. cat <<EOM
  5976.  
  5977. Previous version of $package used the standard IO mechanisms as defined
  5978. in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
  5979. mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
  5980. the default.  This abstraction layer can use AT&T's sfio (if you already
  5981. have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
  5982. problems with some extension modules.  Using PerlIO with stdio is safe,
  5983. but it is slower than plain stdio and therefore is not the default.
  5984.  
  5985. If this doesn't make any sense to you, just accept the default 'n'.
  5986. EOM
  5987. case "$useperlio" in
  5988. $define|true|[yY]*)    dflt='y';;
  5989. *) dflt='n';;
  5990. esac
  5991. rp='Use the experimental PerlIO abstraction layer?'
  5992. . ./myread
  5993. case "$ans" in
  5994. y|Y) 
  5995.     val="$define"
  5996.     ;;     
  5997. *)      
  5998.     echo "Ok, doing things the stdio way"
  5999.     val="$undef"
  6000.     ;;
  6001. esac
  6002. set useperlio
  6003. eval $setvar 
  6004.  
  6005. : Check how to convert floats to strings.
  6006. if test "X$d_Gconvert" = X; then
  6007.     echo " "
  6008.     echo "Checking for an efficient way to convert floats to strings."
  6009.     $cat >try.c <<'EOP'
  6010. #ifdef TRY_gconvert
  6011. #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
  6012. char *myname = "gconvert";
  6013. #endif
  6014. #ifdef TRY_gcvt
  6015. #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
  6016. char *myname = "gcvt";
  6017. #endif
  6018. #ifdef TRY_sprintf
  6019. #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
  6020. char *myname = "sprintf";
  6021. #endif
  6022.  
  6023. #include <stdio.h>
  6024.  
  6025. int
  6026. checkit(expect, got)
  6027. char *expect;
  6028. char *got;
  6029. {
  6030.     if (strcmp(expect, got)) {
  6031.         printf("%s oddity:  Expected %s, got %s\n",
  6032.             myname, expect, got);
  6033.         exit(1);
  6034.     }
  6035. }
  6036.  
  6037. int
  6038. main()
  6039.     char buf[64]; 
  6040.     buf[63] = '\0';
  6041.  
  6042.     /* This must be 1st test on (which?) platform */
  6043.     /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
  6044.     Gconvert(0.1, 8, 0, buf);
  6045.     checkit("0.1", buf);
  6046.  
  6047.     Gconvert(1.0, 8, 0, buf); 
  6048.     checkit("1", buf);
  6049.  
  6050.     Gconvert(0.0, 8, 0, buf); 
  6051.     checkit("0", buf);
  6052.  
  6053.     Gconvert(-1.0, 8, 0, buf); 
  6054.     checkit("-1", buf);
  6055.  
  6056.     /* Some Linux gcvt's give 1.e+5 here. */
  6057.     Gconvert(100000.0, 8, 0, buf); 
  6058.     checkit("100000", buf);
  6059.     
  6060.     /* Some Linux gcvt's give -1.e+5 here. */
  6061.     Gconvert(-100000.0, 8, 0, buf); 
  6062.     checkit("-100000", buf);
  6063.  
  6064.     exit(0);
  6065. }
  6066. EOP
  6067.     case "$d_Gconvert" in
  6068.     gconvert*) xxx_list='gconvert gcvt sprintf' ;;
  6069.     gcvt*) xxx_list='gcvt gconvert sprintf' ;;
  6070.     sprintf*) xxx_list='sprintf gconvert gcvt' ;;
  6071.     *) xxx_list='gconvert gcvt sprintf' ;;
  6072.     esac
  6073.  
  6074.     for xxx_convert in $xxx_list; do
  6075.     echo "Trying $xxx_convert"
  6076.     $rm -f try try$_o
  6077.     set try -DTRY_$xxx_convert
  6078.     if eval $compile; then
  6079.         echo "$xxx_convert" found. >&4
  6080.         if ./try; then
  6081.             echo "I'll use $xxx_convert to convert floats into a string." >&4
  6082.             break;
  6083.         else
  6084.             echo "...But $xxx_convert didn't work as I expected."
  6085.         fi
  6086.     else
  6087.         echo "$xxx_convert NOT found." >&4
  6088.     fi
  6089.     done
  6090.         
  6091.     case "$xxx_convert" in
  6092.     gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
  6093.     gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
  6094.     *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
  6095.     esac
  6096. fi
  6097.  
  6098. : Initialize h_fcntl
  6099. h_fcntl=false
  6100.  
  6101. : Initialize h_sysfile
  6102. h_sysfile=false
  6103.  
  6104. : access call always available on UNIX
  6105. set access d_access
  6106. eval $inlibc
  6107.  
  6108. : locate the flags for 'access()'
  6109. case "$d_access" in
  6110. "$define")
  6111.     echo " "
  6112.     $cat >access.c <<'EOCP'
  6113. #include <sys/types.h>
  6114. #ifdef I_FCNTL
  6115. #include <fcntl.h>
  6116. #endif
  6117. #ifdef I_SYS_FILE
  6118. #include <sys/file.h>
  6119. #endif
  6120. #ifdef I_UNISTD
  6121. #include <unistd.h>
  6122. #endif
  6123. main() {
  6124.     exit(R_OK);
  6125. }
  6126. EOCP
  6127.     : check sys/file.h first, no particular reason here
  6128.     if $test `./findhdr sys/file.h` && \
  6129.         $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
  6130.         h_sysfile=true;
  6131.         echo "<sys/file.h> defines the *_OK access constants." >&4
  6132.     elif $test `./findhdr fcntl.h` && \
  6133.         $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
  6134.         h_fcntl=true;
  6135.         echo "<fcntl.h> defines the *_OK access constants." >&4
  6136.     elif $test `./findhdr unistd.h` && \
  6137.         $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
  6138.         echo "<unistd.h> defines the *_OK access constants." >&4
  6139.     else
  6140.         echo "I can't find the four *_OK access constants--I'll use mine." >&4
  6141.     fi
  6142.     ;;
  6143. esac
  6144. $rm -f access*
  6145.  
  6146. : see if alarm exists
  6147. set alarm d_alarm
  6148. eval $inlibc
  6149.  
  6150. : Look for GNU-cc style attribute checking
  6151. echo " "
  6152. echo "Checking whether your compiler can handle __attribute__ ..." >&4
  6153. $cat >attrib.c <<'EOCP'
  6154. #include <stdio.h>
  6155. void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
  6156. EOCP
  6157. if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
  6158.     if $contains 'warning' attrib.out >/dev/null 2>&1; then
  6159.         echo "Your C compiler doesn't fully support __attribute__."
  6160.         val="$undef"
  6161.     else
  6162.         echo "Your C compiler supports __attribute__."
  6163.         val="$define"
  6164.     fi
  6165. else
  6166.     echo "Your C compiler doesn't seem to understand __attribute__ at all."
  6167.     val="$undef"
  6168. fi
  6169. set d_attribut
  6170. eval $setvar
  6171. $rm -f attrib*
  6172.  
  6173. : see if bcmp exists
  6174. set bcmp d_bcmp
  6175. eval $inlibc
  6176.  
  6177. : see if bcopy exists
  6178. set bcopy d_bcopy
  6179. eval $inlibc
  6180.  
  6181. : see if this is a unistd.h system
  6182. set unistd.h i_unistd
  6183. eval $inhdr
  6184.  
  6185. : see if getpgrp exists
  6186. set getpgrp d_getpgrp
  6187. eval $inlibc
  6188.  
  6189. case "$d_getpgrp" in
  6190. "$define")
  6191.     echo " "
  6192.     echo "Checking to see which flavor of getpgrp is in use..."
  6193.     $cat >set.c <<EOP
  6194. #$i_unistd I_UNISTD
  6195. #include <sys/types.h>
  6196. #ifdef I_UNISTD
  6197. #  include <unistd.h>
  6198. #endif
  6199. main()
  6200. {
  6201.     if (getuid() == 0) {
  6202.         printf("(I see you are running Configure as super-user...)\n");
  6203.         setuid(1);
  6204.     }
  6205. #ifdef TRY_BSD_PGRP
  6206.     if (getpgrp(1) == 0)
  6207.         exit(0);
  6208. #else
  6209.     if (getpgrp() > 0)
  6210.         exit(0);
  6211. #endif
  6212.     exit(1);
  6213. }
  6214. EOP
  6215.     if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
  6216.         echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
  6217.         val="$define"
  6218.     elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
  6219.         echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
  6220.         val="$undef"
  6221.     else
  6222.         echo "I can't seem to compile and run the test program."
  6223.         if ./usg; then
  6224.             xxx="a USG one, i.e. you use getpgrp()."
  6225.         else
  6226.             # SVR4 systems can appear rather BSD-ish.
  6227.             case "$i_unistd" in
  6228.             $undef)
  6229.                 xxx="a BSD one, i.e. you use getpgrp(pid)."
  6230.                 val="$define"
  6231.                 ;;
  6232.             $define)
  6233.                 xxx="probably a USG one, i.e. you use getpgrp()."
  6234.                 val="$undef"
  6235.                 ;;
  6236.             esac
  6237.         fi
  6238.         echo "Assuming your getpgrp is $xxx" >&4
  6239.     fi
  6240.     ;;
  6241. *) val="$undef";;
  6242. esac
  6243. set d_bsdgetpgrp
  6244. eval $setvar
  6245. $rm -f set set.c
  6246.  
  6247. : see if setpgrp exists
  6248. set setpgrp d_setpgrp
  6249. eval $inlibc
  6250.  
  6251. case "$d_setpgrp" in
  6252. "$define")
  6253.     echo " "
  6254.     echo "Checking to see which flavor of setpgrp is in use..."
  6255.     $cat >set.c <<EOP
  6256. #$i_unistd I_UNISTD
  6257. #include <sys/types.h>
  6258. #ifdef I_UNISTD
  6259. #  include <unistd.h>
  6260. #endif
  6261. main()
  6262. {
  6263.     if (getuid() == 0) {
  6264.         printf("(I see you are running Configure as super-user...)\n");
  6265.         setuid(1);
  6266.     }
  6267. #ifdef TRY_BSD_PGRP
  6268.     if (-1 == setpgrp(1, 1))
  6269.         exit(0);
  6270. #else
  6271.     if (setpgrp() != -1)
  6272.         exit(0);
  6273. #endif
  6274.     exit(1);
  6275. }
  6276. EOP
  6277.     if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
  6278.         echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
  6279.         val="$define"
  6280.     elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
  6281.         echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
  6282.         val="$undef"
  6283.     else
  6284.         echo "(I can't seem to compile and run the test program.)"
  6285.         if ./usg; then
  6286.             xxx="a USG one, i.e. you use setpgrp()."
  6287.         else
  6288.             # SVR4 systems can appear rather BSD-ish.
  6289.             case "$i_unistd" in
  6290.             $undef)
  6291.                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
  6292.                 val="$define"
  6293.                 ;;
  6294.             $define)
  6295.                 xxx="probably a USG one, i.e. you use setpgrp()."
  6296.                 val="$undef"
  6297.                 ;;
  6298.             esac
  6299.         fi
  6300.         echo "Assuming your setpgrp is $xxx" >&4
  6301.     fi
  6302.     ;;
  6303. *) val="$undef";;
  6304. esac
  6305. set d_bsdsetpgrp
  6306. eval $setvar
  6307. $rm -f set set.c
  6308. : see if bzero exists
  6309. set bzero d_bzero
  6310. eval $inlibc
  6311.  
  6312. : check for lengths of integral types
  6313. echo " "
  6314. case "$intsize" in
  6315. '')
  6316.     echo "Checking to see how big your integers are..." >&4
  6317.     $cat >intsize.c <<'EOCP'
  6318. #include <stdio.h>
  6319. main()
  6320. {
  6321.     printf("intsize=%d;\n", sizeof(int));
  6322.     printf("longsize=%d;\n", sizeof(long));
  6323.     printf("shortsize=%d;\n", sizeof(short));
  6324.     exit(0);
  6325. }
  6326. EOCP
  6327.     set intsize
  6328.     if eval $compile_ok && ./intsize > /dev/null; then
  6329.         eval `./intsize`
  6330.         echo "Your integers are $intsize bytes long."
  6331.         echo "Your long integers are $longsize bytes long."
  6332.         echo "Your short integers are $shortsize bytes long."
  6333.     else
  6334.         $cat >&4 <<EOM
  6335. !
  6336. Help! I can't compile and run the intsize test program: please enlighten me!
  6337. (This is probably a misconfiguration in your system or libraries, and
  6338. you really ought to fix it.  Still, I'll try anyway.)
  6339. !
  6340. EOM
  6341.         dflt=4
  6342.         rp="What is the size of an integer (in bytes)?"
  6343.         . ./myread
  6344.         intsize="$ans"
  6345.         dflt=$intsize
  6346.         rp="What is the size of a long integer (in bytes)?"
  6347.         . ./myread
  6348.         longsize="$ans"
  6349.         dflt=2
  6350.         rp="What is the size of a short integer (in bytes)?"
  6351.         . ./myread
  6352.         shortsize="$ans"
  6353.     fi
  6354.     ;;
  6355. esac
  6356. $rm -f intsize intsize.*
  6357.  
  6358. : see if signal is declared as pointer to function returning int or void
  6359. echo " "
  6360. xxx=`./findhdr signal.h`
  6361. $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
  6362. if $contains 'int.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  6363.     echo "You have int (*signal())() instead of void." >&4
  6364.     val="$undef"
  6365. elif $contains 'void.*\*[     ]*signal' $$.tmp >/dev/null 2>&1 ; then
  6366.     echo "You have void (*signal())()." >&4
  6367.     val="$define"
  6368. elif $contains 'extern[     ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
  6369.     echo "You have int (*signal())() instead of void." >&4
  6370.     val="$undef"
  6371. elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
  6372.     echo "You have void (*signal())()." >&4
  6373.     val="$define"
  6374. else
  6375.     case "$d_voidsig" in
  6376.     '')
  6377.     echo "I can't determine whether signal handler returns void or int..." >&4
  6378.         dflt=void
  6379.         rp="What type does your signal handler return?"
  6380.         . ./myread
  6381.         case "$ans" in
  6382.         v*) val="$define";;
  6383.         *) val="$undef";;
  6384.         esac;;
  6385.     "$define")
  6386.         echo "As you already told me, signal handler returns void." >&4
  6387.         val="$define"
  6388.         ;;
  6389.     *)    echo "As you already told me, signal handler returns int." >&4
  6390.         val="$undef"
  6391.         ;;
  6392.     esac
  6393. fi
  6394. set d_voidsig
  6395. eval $setvar
  6396. case "$d_voidsig" in
  6397. "$define") signal_t="void";;
  6398. *) signal_t="int";;
  6399. esac
  6400. $rm -f $$.tmp
  6401.  
  6402. : check for ability to cast large floats to 32-bit ints.
  6403. echo " "
  6404. echo 'Checking whether your C compiler can cast large floats to int32.' >&4
  6405. if $test "$intsize" -ge 4; then
  6406.     xxx=int
  6407. else
  6408.     xxx=long
  6409. fi
  6410. $cat >try.c <<EOCP
  6411. #include <stdio.h>
  6412. #include <sys/types.h>
  6413. #include <signal.h>
  6414. $signal_t blech(s) int s; { exit(3); }
  6415. main()
  6416. {
  6417.     $xxx i32;
  6418.     double f, g;
  6419.     int result = 0;
  6420.     char str[16];
  6421.     signal(SIGFPE, blech);
  6422.  
  6423.     /* Don't let compiler optimize the test away.  Store the number 
  6424.        in a writable string for gcc to pass to sscanf under HP/UX.
  6425.     */
  6426.     sprintf(str, "2147483647");
  6427.     sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
  6428.     g = 10 * f;
  6429.     i32  = ($xxx) g;
  6430.  
  6431.     /* x86 processors will probably give 0x8000 0000, which is a
  6432.        sign change.  We don't want that.  We want to mimic SPARC
  6433.        behavior here, which is to preserve the sign and give
  6434.        back 0x7fff ffff.
  6435.     */
  6436.     if (i32 != ($xxx) f)
  6437.         result |= 1;
  6438.     exit(result);
  6439. }
  6440. EOCP
  6441. set try
  6442. if eval $compile_ok; then
  6443.     ./try
  6444.     yyy=$?
  6445. else
  6446.     echo "(I can't seem to compile the test program--assuming it can't)"
  6447.     yyy=1
  6448. fi
  6449. case "$yyy" in
  6450. 0)    val="$define"
  6451.     echo "Yup, it can."
  6452.     ;;
  6453. *)    val="$undef"
  6454.     echo "Nope, it can't."
  6455.     ;;
  6456. esac
  6457. set d_casti32
  6458. eval $setvar
  6459. $rm -f try try.*
  6460.  
  6461. : check for ability to cast negative floats to unsigned
  6462. echo " "
  6463. echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
  6464. $cat >try.c <<EOCP
  6465. #include <stdio.h>
  6466. #include <sys/types.h>
  6467. #include <signal.h>
  6468. $signal_t blech(s) int s; { exit(7); }
  6469. $signal_t blech_in_list(s) int s; { exit(4); }
  6470. unsigned long dummy_long(p) unsigned long p; { return p; }
  6471. unsigned int dummy_int(p) unsigned int p; { return p; }
  6472. unsigned short dummy_short(p) unsigned short p; { return p; }
  6473. main()
  6474. {
  6475.     double f;
  6476.     unsigned long along;
  6477.     unsigned int aint;
  6478.     unsigned short ashort;
  6479.     int result = 0;
  6480.     char str[16];
  6481.     
  6482.     /* Frustrate gcc-2.7.2's optimizer which failed this test with
  6483.        a direct f = -123. assignment.  gcc-2.8.0 reportedly
  6484.        optimized the whole file away
  6485.     */
  6486.     /* Store the number in a writable string for gcc to pass to 
  6487.        sscanf under HP/UX.
  6488.     */
  6489.     sprintf(str, "-123");
  6490.     sscanf(str, "%lf", &f);  /* f = -123.; */
  6491.  
  6492.     signal(SIGFPE, blech);
  6493.     along = (unsigned long)f;
  6494.     aint = (unsigned int)f;
  6495.     ashort = (unsigned short)f;
  6496.     if (along != (unsigned long)-123)
  6497.         result |= 1;
  6498.     if (aint != (unsigned int)-123)
  6499.         result |= 1;
  6500.     if (ashort != (unsigned short)-123)
  6501.         result |= 1;
  6502.     sprintf(str, "1073741824.");
  6503.     sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
  6504.     f = f + f;
  6505.     along = 0;
  6506.     along = (unsigned long)f;
  6507.     if (along != 0x80000000)
  6508.         result |= 2;
  6509.     f -= 1.;
  6510.     along = 0;
  6511.     along = (unsigned long)f;
  6512.     if (along != 0x7fffffff)
  6513.         result |= 1;
  6514.     f += 2.;
  6515.     along = 0;
  6516.     along = (unsigned long)f;
  6517.     if (along != 0x80000001)
  6518.         result |= 2;
  6519.     if (result)
  6520.         exit(result);
  6521.     signal(SIGFPE, blech_in_list);
  6522.     sprintf(str, "123.");
  6523.     sscanf(str, "%lf", &f);  /* f = 123.; */
  6524.     along = dummy_long((unsigned long)f);
  6525.     aint = dummy_int((unsigned int)f);
  6526.     ashort = dummy_short((unsigned short)f);
  6527.     if (along != (unsigned long)123)
  6528.         result |= 4;
  6529.     if (aint != (unsigned int)123)
  6530.         result |= 4;
  6531.     if (ashort != (unsigned short)123)
  6532.         result |= 4;
  6533.     exit(result);
  6534.  
  6535. }
  6536. EOCP
  6537. set try
  6538. if eval $compile_ok; then
  6539.     ./try
  6540.     castflags=$?
  6541. else
  6542.     echo "(I can't seem to compile the test program--assuming it can't)"
  6543.     castflags=7
  6544. fi
  6545. case "$castflags" in
  6546. 0)    val="$define"
  6547.     echo "Yup, it can."
  6548.     ;;
  6549. *)    val="$undef"
  6550.     echo "Nope, it can't."
  6551.     ;;
  6552. esac
  6553. set d_castneg
  6554. eval $setvar
  6555. $rm -f try.*
  6556.  
  6557. : see if vprintf exists
  6558. echo " "
  6559. if set vprintf val -f d_vprintf; eval $csym; $val; then
  6560.     echo 'vprintf() found.' >&4
  6561.     val="$define"
  6562.     $cat >vprintf.c <<'EOF'
  6563. #include <varargs.h>
  6564.  
  6565. main() { xxx("foo"); }
  6566.  
  6567. xxx(va_alist)
  6568. va_dcl
  6569. {
  6570.     va_list args;
  6571.     char buf[10];
  6572.  
  6573.     va_start(args);
  6574.     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
  6575. }
  6576. EOF
  6577.     set vprintf
  6578.     if eval $compile && ./vprintf; then
  6579.         echo "Your vsprintf() returns (int)." >&4
  6580.         val2="$undef"
  6581.     else
  6582.         echo "Your vsprintf() returns (char*)." >&4
  6583.         val2="$define"
  6584.     fi
  6585. else
  6586.     echo 'vprintf() NOT found.' >&4
  6587.         val="$undef"
  6588.         val2="$undef"
  6589. fi
  6590. set d_vprintf
  6591. eval $setvar
  6592. val=$val2
  6593. set d_charvspr
  6594. eval $setvar
  6595.  
  6596. : see if chown exists
  6597. set chown d_chown
  6598. eval $inlibc
  6599.  
  6600. : see if chroot exists
  6601. set chroot d_chroot
  6602. eval $inlibc
  6603.  
  6604. : see if chsize exists
  6605. set chsize d_chsize
  6606. eval $inlibc
  6607.  
  6608. : check for const keyword
  6609. echo " "
  6610. echo 'Checking to see if your C compiler knows about "const"...' >&4
  6611. $cat >const.c <<'EOCP'
  6612. typedef struct spug { int drokk; } spug;
  6613. main()
  6614. {
  6615.     const char *foo;
  6616.     const spug y;
  6617. }
  6618. EOCP
  6619. if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
  6620.     val="$define"
  6621.     echo "Yup, it does."
  6622. else
  6623.     val="$undef"
  6624.     echo "Nope, it doesn't."
  6625. fi
  6626. set d_const
  6627. eval $setvar
  6628.  
  6629. : see if crypt exists
  6630. echo " "
  6631. if set crypt val -f d_crypt; eval $csym; $val; then
  6632.     echo 'crypt() found.' >&4
  6633.     val="$define"
  6634.     cryptlib=''
  6635. else
  6636.     cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
  6637.     if $test -z "$cryptlib"; then
  6638.         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
  6639.     else
  6640.         cryptlib=-lcrypt
  6641.     fi
  6642.     if $test -z "$cryptlib"; then
  6643.         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
  6644.     else
  6645.         cryptlib=-lcrypt
  6646.     fi
  6647.     if $test -z "$cryptlib"; then
  6648.         cryptlib=`./loc libcrypt$_a "" $libpth`
  6649.     else
  6650.         cryptlib=-lcrypt
  6651.     fi
  6652.     if $test -z "$cryptlib"; then
  6653.         echo 'crypt() NOT found.' >&4
  6654.         val="$undef"
  6655.     else
  6656.         val="$define"
  6657.     fi
  6658. fi
  6659. set d_crypt
  6660. eval $setvar
  6661.  
  6662. : see if cuserid exists
  6663. set cuserid d_cuserid
  6664. eval $inlibc
  6665.  
  6666. : see if this is a limits.h system
  6667. set limits.h i_limits
  6668. eval $inhdr
  6669.  
  6670. : see if this is a float.h system
  6671. set float.h i_float
  6672. eval $inhdr
  6673.  
  6674. : See if number of significant digits in a double precision number is known
  6675. echo " "
  6676. $cat >dbl_dig.c <<EOM
  6677. #$i_limits I_LIMITS
  6678. #$i_float I_FLOAT
  6679. #ifdef I_LIMITS
  6680. #include <limits.h>
  6681. #endif
  6682. #ifdef I_FLOAT
  6683. #include <float.h>
  6684. #endif
  6685. #ifdef DBL_DIG
  6686. printf("Contains DBL_DIG");
  6687. #endif
  6688. EOM
  6689. $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
  6690. if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
  6691.     echo "DBL_DIG found." >&4
  6692.     val="$define"
  6693. else
  6694.     echo "DBL_DIG NOT found." >&4
  6695.     val="$undef"
  6696. fi
  6697. $rm -f dbl_dig.?
  6698. set d_dbl_dig
  6699. eval $setvar
  6700.  
  6701. : see if difftime exists
  6702. set difftime d_difftime
  6703. eval $inlibc
  6704.  
  6705. : see if this is a dirent system
  6706. echo " "
  6707. if xinc=`./findhdr dirent.h`; $test "$xinc"; then
  6708.     val="$define"
  6709.     echo "<dirent.h> found." >&4
  6710. else
  6711.     val="$undef"
  6712.     if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
  6713.         echo "<sys/dir.h> found." >&4
  6714.         echo " "
  6715.     else
  6716.         xinc=`./findhdr sys/ndir.h`
  6717.     fi
  6718.     echo "<dirent.h> NOT found." >&4
  6719. fi
  6720. set i_dirent
  6721. eval $setvar
  6722.  
  6723. : Look for type of directory structure.
  6724. echo " "
  6725. $cppstdin $cppflags $cppminus < "$xinc" > try.c
  6726.  
  6727. case "$direntrytype" in
  6728. ''|' ')
  6729.     case "$i_dirent" in
  6730.     $define) guess1='struct dirent' ;;
  6731.     *) guess1='struct direct'  ;;
  6732.     esac
  6733.     ;;
  6734. *)    guess1="$direntrytype"
  6735.     ;;
  6736. esac
  6737.  
  6738. case "$guess1" in
  6739. 'struct dirent') guess2='struct direct' ;;
  6740. *) guess2='struct dirent' ;;
  6741. esac
  6742.         
  6743. if $contains "$guess1" try.c >/dev/null 2>&1; then
  6744.     direntrytype="$guess1"
  6745.     echo "Your directory entries are $direntrytype." >&4
  6746. elif $contains "$guess2" try.c >/dev/null 2>&1; then
  6747.     direntrytype="$guess2"
  6748.     echo "Your directory entries seem to be $direntrytype." >&4
  6749. else
  6750.     echo "I don't recognize your system's directory entries." >&4
  6751.     rp="What type is used for directory entries on this system?"
  6752.     dflt="$guess1"
  6753.     . ./myread
  6754.     direntrytype="$ans"
  6755. fi
  6756. $rm -f try.c
  6757.  
  6758.  
  6759. : see if the directory entry stores field length
  6760. echo " "
  6761. $cppstdin $cppflags $cppminus < "$xinc" > try.c
  6762. if $contains 'd_namlen' try.c >/dev/null 2>&1; then
  6763.     echo "Good, your directory entry keeps length information in d_namlen." >&4
  6764.     val="$define"
  6765. else
  6766.     echo "Your directory entry does not know about the d_namlen field." >&4
  6767.     val="$undef"
  6768. fi
  6769. set d_dirnamlen
  6770. eval $setvar
  6771. $rm -f try.c
  6772.  
  6773. : see if dlerror exists
  6774. xxx_runnm="$runnm"
  6775. runnm=false
  6776. set dlerror d_dlerror
  6777. eval $inlibc
  6778. runnm="$xxx_runnm"
  6779.  
  6780. : see if dlfcn is available
  6781. set dlfcn.h i_dlfcn
  6782. eval $inhdr
  6783.  
  6784. case "$usedl" in
  6785. $define|y|true)
  6786.     $cat << EOM
  6787.  
  6788. On a few systems, the dynamically loaded modules that perl generates and uses
  6789. will need a different extension than shared libs. The default will probably
  6790. be appropriate.
  6791.  
  6792. EOM
  6793.     case "$dlext" in
  6794.     '')    dflt="$so" ;;
  6795.     *)    dflt="$dlext" ;;
  6796.     esac
  6797.     rp='What is the extension of dynamically loaded modules'
  6798.     . ./myread
  6799.     dlext="$ans"
  6800.     ;;
  6801. *)
  6802.     dlext="none"
  6803.     ;;
  6804. esac
  6805.  
  6806. : Check if dlsym need a leading underscore
  6807. echo " "
  6808. val="$undef"
  6809.  
  6810. case "$dlsrc" in
  6811. dl_dlopen.xs)
  6812.     echo "Checking whether your dlsym() needs a leading underscore ..." >&4
  6813.     $cat >dyna.c <<'EOM'
  6814. fred () { }
  6815. EOM
  6816.  
  6817. $cat >fred.c<<EOM
  6818.  
  6819. #include <stdio.h>
  6820. #$i_dlfcn I_DLFCN
  6821. #ifdef I_DLFCN
  6822. #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
  6823. #else
  6824. #include <sys/types.h>
  6825. #include <nlist.h>
  6826. #include <link.h>
  6827. #endif
  6828.  
  6829. extern int fred() ;
  6830.  
  6831. main()
  6832. {
  6833.     void * handle ;
  6834.     void * symbol ;
  6835. #ifndef RTLD_LAZY
  6836.     int mode = 1 ;
  6837. #else
  6838.     int mode = RTLD_LAZY ;
  6839. #endif
  6840.     handle = dlopen("./dyna.$dlext", mode) ;
  6841.     if (handle == NULL) {
  6842.     printf ("1\n") ;
  6843.     fflush (stdout) ;
  6844.     exit(0);
  6845.     }
  6846.     symbol = dlsym(handle, "fred") ;
  6847.     if (symbol == NULL) {
  6848.     /* try putting a leading underscore */
  6849.     symbol = dlsym(handle, "_fred") ;
  6850.     if (symbol == NULL) {
  6851.         printf ("2\n") ;
  6852.         fflush (stdout) ;
  6853.         exit(0);
  6854.     }
  6855.     printf ("3\n") ;
  6856.     }
  6857.     else
  6858.     printf ("4\n") ;
  6859.     fflush (stdout) ;
  6860.     exit(0);
  6861. }
  6862. EOM
  6863.     : Call the object file tmp-dyna.o in case dlext=o.
  6864.     if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
  6865.         mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
  6866.         $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
  6867.         $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
  6868.         xxx=`./fred`
  6869.         case $xxx in
  6870.         1)    echo "Test program failed using dlopen." >&4
  6871.             echo "Perhaps you should not use dynamic loading." >&4;;
  6872.         2)    echo "Test program failed using dlsym." >&4
  6873.             echo "Perhaps you should not use dynamic loading." >&4;;
  6874.         3)    echo "dlsym needs a leading underscore" >&4
  6875.             val="$define" ;;
  6876.         4)    echo "dlsym doesn't need a leading underscore." >&4;;
  6877.         esac
  6878.     else
  6879.         echo "I can't compile and run the test program." >&4
  6880.     fi
  6881.     ;;
  6882. esac
  6883.         
  6884. $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
  6885.  
  6886. set d_dlsymun
  6887. eval $setvar
  6888.  
  6889. : see if dup2 exists
  6890. set dup2 d_dup2
  6891. eval $inlibc
  6892.  
  6893. : see if endhostent exists
  6894. set endhostent d_endhent
  6895. eval $inlibc
  6896.  
  6897. : see if endnetent exists
  6898. set endnetent d_endnent
  6899. eval $inlibc
  6900.  
  6901. : see if endprotoent exists
  6902. set endprotoent d_endpent
  6903. eval $inlibc
  6904.  
  6905. : see if endservent exists
  6906. set endservent d_endsent
  6907. eval $inlibc
  6908.  
  6909. : Locate the flags for 'open()'
  6910. echo " "
  6911. $cat >open3.c <<'EOCP'
  6912. #include <sys/types.h>
  6913. #ifdef I_FCNTL
  6914. #include <fcntl.h>
  6915. #endif
  6916. #ifdef I_SYS_FILE
  6917. #include <sys/file.h>
  6918. #endif
  6919. main() {
  6920.     if(O_RDONLY);
  6921. #ifdef O_TRUNC
  6922.     exit(0);
  6923. #else
  6924.     exit(1);
  6925. #endif
  6926. }
  6927. EOCP
  6928. : check sys/file.h first to get FREAD on Sun
  6929. if $test `./findhdr sys/file.h` && \
  6930.         set open3 -DI_SYS_FILE && eval $compile; then
  6931.     h_sysfile=true;
  6932.     echo "<sys/file.h> defines the O_* constants..." >&4
  6933.     if ./open3; then
  6934.         echo "and you have the 3 argument form of open()." >&4
  6935.         val="$define"
  6936.     else
  6937.         echo "but not the 3 argument form of open().  Oh, well." >&4
  6938.         val="$undef"
  6939.     fi
  6940. elif $test `./findhdr fcntl.h` && \
  6941.         set open3 -DI_FCNTL && eval $compile; then
  6942.     h_fcntl=true;
  6943.     echo "<fcntl.h> defines the O_* constants..." >&4
  6944.     if ./open3; then
  6945.         echo "and you have the 3 argument form of open()." >&4
  6946.         val="$define"
  6947.     else
  6948.         echo "but not the 3 argument form of open().  Oh, well." >&4
  6949.         val="$undef"
  6950.     fi
  6951. else
  6952.     val="$undef"
  6953.     echo "I can't find the O_* constant definitions!  You got problems." >&4
  6954. fi
  6955. set d_open3
  6956. eval $setvar
  6957. $rm -f open3*
  6958.  
  6959. : check for non-blocking I/O stuff
  6960. case "$h_sysfile" in
  6961. true) echo "#include <sys/file.h>" > head.c;;
  6962. *)
  6963.     case "$h_fcntl" in
  6964.     true) echo "#include <fcntl.h>" > head.c;;
  6965.     *) echo "#include <sys/fcntl.h>" > head.c;;
  6966.     esac
  6967.     ;;
  6968. esac
  6969. echo " "
  6970. echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
  6971. case "$o_nonblock" in
  6972. '')
  6973.     $cat head.c > try.c
  6974.     $cat >>try.c <<'EOCP'
  6975. main() {
  6976. #ifdef O_NONBLOCK
  6977.     printf("O_NONBLOCK\n");
  6978.     exit(0);
  6979. #endif
  6980. #ifdef O_NDELAY
  6981.     printf("O_NDELAY\n");
  6982.     exit(0);
  6983. #endif
  6984. #ifdef FNDELAY
  6985.     printf("FNDELAY\n");
  6986.     exit(0);
  6987. #endif
  6988.     exit(0);
  6989. }
  6990. EOCP
  6991.     set try
  6992.     if eval $compile_ok; then
  6993.         o_nonblock=`./try`
  6994.         case "$o_nonblock" in
  6995.         '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
  6996.         *) echo "Seems like we can use $o_nonblock.";;
  6997.         esac
  6998.     else
  6999.         echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
  7000.     fi
  7001.     ;;
  7002. *) echo "Using $hint value $o_nonblock.";;
  7003. esac
  7004. $rm -f try try.* .out core
  7005.  
  7006. echo " "
  7007. echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
  7008. case "$eagain" in
  7009. '')
  7010.     $cat head.c > try.c
  7011.     $cat >>try.c <<EOCP
  7012. #include <errno.h>
  7013. #include <sys/types.h>
  7014. #include <signal.h>
  7015. #define MY_O_NONBLOCK $o_nonblock
  7016. #ifndef errno  /* XXX need better Configure test */
  7017. extern int errno;
  7018. #endif
  7019. $signal_t blech(x) int x; { exit(3); }
  7020. EOCP
  7021.     $cat >> try.c <<'EOCP'
  7022. main()
  7023. {
  7024.     int pd[2];
  7025.     int pu[2];
  7026.     char buf[1];
  7027.     char string[100];
  7028.  
  7029.     pipe(pd);    /* Down: child -> parent */
  7030.     pipe(pu);    /* Up: parent -> child */
  7031.     if (0 != fork()) {
  7032.         int ret;
  7033.         close(pd[1]);    /* Parent reads from pd[0] */
  7034.         close(pu[0]);    /* Parent writes (blocking) to pu[1] */
  7035.         if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
  7036.             exit(1);
  7037.         signal(SIGALRM, blech);
  7038.         alarm(5);
  7039.         if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
  7040.             exit(2);
  7041.         sprintf(string, "%d\n", ret);
  7042.         write(2, string, strlen(string));
  7043.         alarm(0);
  7044. #ifdef EAGAIN
  7045.         if (errno == EAGAIN) {
  7046.             printf("EAGAIN\n");
  7047.             goto ok;
  7048.         }
  7049. #endif
  7050. #ifdef EWOULDBLOCK
  7051.         if (errno == EWOULDBLOCK)
  7052.             printf("EWOULDBLOCK\n");
  7053. #endif
  7054.     ok:
  7055.         write(pu[1], buf, 1);    /* Unblocks child, tell it to close our pipe */
  7056.         sleep(2);                /* Give it time to close our pipe */
  7057.         alarm(5);
  7058.         ret = read(pd[0], buf, 1);    /* Should read EOF */
  7059.         alarm(0);
  7060.         sprintf(string, "%d\n", ret);
  7061.         write(3, string, strlen(string));
  7062.         exit(0);
  7063.     }
  7064.  
  7065.     close(pd[0]);            /* We write to pd[1] */
  7066.     close(pu[1]);            /* We read from pu[0] */
  7067.     read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
  7068.     close(pd[1]);            /* Pipe pd is now fully closed! */
  7069.     exit(0);                /* Bye bye, thank you for playing! */
  7070. }
  7071. EOCP
  7072.     set try
  7073.     if eval $compile_ok; then
  7074.         echo "$startsh" >mtry
  7075.         echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
  7076.         chmod +x mtry
  7077.         ./mtry >/dev/null 2>&1
  7078.         case $? in
  7079.         0) eagain=`$cat try.out`;;
  7080.         1) echo "Could not perform non-blocking setting!";;
  7081.         2) echo "I did a successful read() for something that was not there!";;
  7082.         3) echo "Hmm... non-blocking I/O does not seem to be working!";;
  7083.         *) echo "Something terribly wrong happened during testing.";;
  7084.         esac
  7085.         rd_nodata=`$cat try.ret`
  7086.         echo "A read() system call with no data present returns $rd_nodata."
  7087.         case "$rd_nodata" in
  7088.         0|-1) ;;
  7089.         *)
  7090.             echo "(That's peculiar, fixing that to be -1.)"
  7091.             rd_nodata=-1
  7092.             ;;
  7093.         esac
  7094.         case "$eagain" in
  7095.         '')
  7096.             echo "Forcing errno EAGAIN on read() with no data available."
  7097.             eagain=EAGAIN
  7098.             ;;
  7099.         *)
  7100.             echo "Your read() sets errno to $eagain when no data is available."
  7101.             ;;
  7102.         esac
  7103.         status=`$cat try.err`
  7104.         case "$status" in
  7105.         0) echo "And it correctly returns 0 to signal EOF.";;
  7106.         -1) echo "But it also returns -1 to signal EOF, so be careful!";;
  7107.         *) echo "However, your read() returns '$status' on EOF??";;
  7108.         esac
  7109.         val="$define"
  7110.         if test "$status" = "$rd_nodata"; then
  7111.             echo "WARNING: you can't distinguish between EOF and no data!"
  7112.             val="$undef"
  7113.         fi
  7114.     else
  7115.         echo "I can't compile the test program--assuming errno EAGAIN will do."
  7116.         eagain=EAGAIN
  7117.     fi
  7118.     set d_eofnblk
  7119.     eval $setvar
  7120.     ;;
  7121. *)
  7122.     echo "Using $hint value $eagain."
  7123.     echo "Your read() returns $rd_nodata when no data is present."
  7124.     case "$d_eofnblk" in
  7125.     "$define") echo "And you can see EOF because read() returns 0.";;
  7126.     "$undef") echo "But you can't see EOF status from read() returned value.";;
  7127.     *)
  7128.         echo "(Assuming you can't see EOF status from read anyway.)"
  7129.         d_eofnblk=$undef
  7130.         ;;
  7131.     esac
  7132.     ;;
  7133. esac
  7134. $rm -f try try.* .out core head.c mtry
  7135.  
  7136. : see if fchmod exists
  7137. set fchmod d_fchmod
  7138. eval $inlibc
  7139.  
  7140. : see if fchown exists
  7141. set fchown d_fchown
  7142. eval $inlibc
  7143.  
  7144. : see if this is an fcntl system
  7145. set fcntl d_fcntl
  7146. eval $inlibc
  7147.  
  7148. : see if fgetpos exists
  7149. set fgetpos d_fgetpos
  7150. eval $inlibc
  7151.  
  7152. : see if flock exists
  7153. set flock d_flock
  7154. eval $inlibc
  7155.  
  7156. : see if fork exists
  7157. set fork d_fork
  7158. eval $inlibc
  7159.  
  7160. : see if pathconf exists
  7161. set pathconf d_pathconf
  7162. eval $inlibc
  7163.  
  7164. : see if fpathconf exists
  7165. set fpathconf d_fpathconf
  7166. eval $inlibc
  7167.  
  7168. : see if fsetpos exists
  7169. set fsetpos d_fsetpos
  7170. eval $inlibc
  7171.  
  7172. : see if gethostbyaddr exists
  7173. set gethostbyaddr d_gethbyaddr
  7174. eval $inlibc
  7175.  
  7176. : see if gethostbyname exists
  7177. set gethostbyname d_gethbyname
  7178. eval $inlibc
  7179.  
  7180. : see if gethostent exists
  7181. set gethostent d_gethent
  7182. eval $inlibc
  7183.  
  7184. hasproto='varname=$1; func=$2; shift; shift;
  7185. while $test $# -ge 2; do
  7186.     case "$1" in
  7187.     $define) echo "#include <$2>";;
  7188.     esac ;
  7189.     shift 2;
  7190. done > try.c;
  7191. $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
  7192. if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
  7193.     echo "$func() prototype found.";
  7194.     val="$define";
  7195. else
  7196.     echo "$func() prototype NOT found.";
  7197.     val="$undef";
  7198. fi;
  7199. set $varname;
  7200. eval $setvar;
  7201. $rm -f try.c tryout.c'
  7202.  
  7203. : see if this is a netdb.h system
  7204. set netdb.h i_netdb
  7205. eval $inhdr
  7206.  
  7207. : see if prototypes for various gethostxxx netdb.h functions are available
  7208. echo " "
  7209. set d_gethostprotos gethostent $i_netdb netdb.h
  7210. eval $hasproto
  7211.  
  7212. : see if getlogin exists
  7213. set getlogin d_getlogin
  7214. eval $inlibc
  7215.  
  7216. : see if getnetbyaddr exists
  7217. set getnetbyaddr d_getnbyaddr
  7218. eval $inlibc
  7219.  
  7220. : see if getnetbyname exists
  7221. set getnetbyname d_getnbyname
  7222. eval $inlibc
  7223.  
  7224. : see if getnetent exists
  7225. set getnetent d_getnent
  7226. eval $inlibc
  7227.  
  7228. : see if prototypes for various getnetxxx netdb.h functions are available
  7229. echo " "
  7230. set d_getnetprotos getnetent $i_netdb netdb.h
  7231. eval $hasproto
  7232.  
  7233.  
  7234. : see if getprotobyname exists
  7235. set getprotobyname d_getpbyname
  7236. eval $inlibc
  7237.  
  7238. : see if getprotobynumber exists
  7239. set getprotobynumber d_getpbynumber
  7240. eval $inlibc
  7241.  
  7242. : see if getprotoent exists
  7243. set getprotoent d_getpent
  7244. eval $inlibc
  7245.  
  7246. : see if getpgid exists
  7247. set getpgid d_getpgid
  7248. eval $inlibc
  7249.  
  7250. : see if getpgrp2 exists
  7251. set getpgrp2 d_getpgrp2
  7252. eval $inlibc
  7253.  
  7254. : see if getppid exists
  7255. set getppid d_getppid
  7256. eval $inlibc
  7257.  
  7258. : see if getpriority exists
  7259. set getpriority d_getprior
  7260. eval $inlibc
  7261.  
  7262. : see if prototypes for various getprotoxxx netdb.h functions are available
  7263. echo " "
  7264. set d_getprotoprotos getprotoent $i_netdb netdb.h
  7265. eval $hasproto
  7266.  
  7267. : see if getservbyname exists
  7268. set getservbyname d_getsbyname
  7269. eval $inlibc
  7270.  
  7271. : see if getservbyport exists
  7272. set getservbyport d_getsbyport
  7273. eval $inlibc
  7274.  
  7275. : see if getservent exists
  7276. set getservent d_getsent
  7277. eval $inlibc
  7278.  
  7279. : see if prototypes for various getservxxx netdb.h functions are available
  7280. echo " "
  7281. set d_getservprotos getservent $i_netdb netdb.h
  7282. eval $hasproto
  7283.  
  7284. : see if gettimeofday or ftime exists
  7285. set gettimeofday d_gettimeod
  7286. eval $inlibc
  7287. case "$d_gettimeod" in
  7288. "$undef")
  7289.     set ftime d_ftime 
  7290.     eval $inlibc
  7291.     ;;
  7292. *)
  7293.     val="$undef"; set d_ftime; eval $setvar
  7294.     ;;
  7295. esac
  7296. case "$d_gettimeod$d_ftime" in
  7297. "$undef$undef")
  7298.     echo " "
  7299.     echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
  7300.     ;;
  7301. esac
  7302.  
  7303. : see if this is a netinet/in.h or sys/in.h system
  7304. set netinet/in.h i_niin sys/in.h i_sysin
  7305. eval $inhdr
  7306.  
  7307. : see if this is an arpa/inet.h
  7308. set arpa/inet.h i_arpainet
  7309. eval $inhdr
  7310.  
  7311. : see if htonl --and friends-- exists
  7312. val=''
  7313. set htonl val
  7314. eval $inlibc
  7315.  
  7316. : Maybe they are macros.
  7317. case "$val" in
  7318. $undef)
  7319.     $cat >htonl.c <<EOM
  7320. #include <stdio.h>
  7321. #include <sys/types.h>
  7322. #$i_niin I_NETINET_IN
  7323. #$i_sysin I_SYS_IN
  7324. #$i_arpainet I_ARPA_INET
  7325. #ifdef I_NETINET_IN
  7326. #include <netinet/in.h>
  7327. #endif
  7328. #ifdef I_SYS_IN
  7329. #include <sys/in.h>
  7330. #endif
  7331. #ifdef I_ARPA_INET
  7332. #include <arpa/inet.h>
  7333. #endif
  7334. #ifdef htonl
  7335. printf("Defined as a macro.");
  7336. #endif
  7337. EOM
  7338.     $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
  7339.     if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
  7340.         val="$define"
  7341.         echo "But it seems to be defined as a macro." >&4
  7342.     fi
  7343.     $rm -f htonl.?
  7344.     ;;
  7345. esac
  7346. set d_htonl
  7347. eval $setvar
  7348.  
  7349. : see which of string.h or strings.h is needed
  7350. echo " "
  7351. strings=`./findhdr string.h`
  7352. if $test "$strings" && $test -r "$strings"; then
  7353.     echo "Using <string.h> instead of <strings.h>." >&4
  7354.     val="$define"
  7355. else
  7356.     val="$undef"
  7357.     strings=`./findhdr strings.h`
  7358.     if $test "$strings" && $test -r "$strings"; then
  7359.         echo "Using <strings.h> instead of <string.h>." >&4
  7360.     else
  7361.         echo "No string header found -- You'll surely have problems." >&4
  7362.     fi
  7363. fi
  7364. set i_string
  7365. eval $setvar
  7366. case "$i_string" in
  7367. "$undef") strings=`./findhdr strings.h`;;
  7368. *)      strings=`./findhdr string.h`;;
  7369. esac
  7370.  
  7371. : index or strchr
  7372. echo " "
  7373. if set index val -f; eval $csym; $val; then
  7374.     if set strchr val -f d_strchr; eval $csym; $val; then
  7375.         if $contains strchr "$strings" >/dev/null 2>&1 ; then
  7376.             val="$define"
  7377.             vali="$undef"
  7378.             echo "strchr() found." >&4
  7379.         else
  7380.             val="$undef"
  7381.             vali="$define"
  7382.             echo "index() found." >&4
  7383.         fi
  7384.     else
  7385.         val="$undef"
  7386.         vali="$define"
  7387.         echo "index() found." >&4
  7388.     fi
  7389. else
  7390.     if set strchr val -f d_strchr; eval $csym; $val; then
  7391.         val="$define"
  7392.         vali="$undef"
  7393.         echo "strchr() found." >&4
  7394.     else
  7395.         echo "No index() or strchr() found!" >&4
  7396.         val="$undef"
  7397.         vali="$undef"
  7398.     fi
  7399. fi
  7400. set d_strchr; eval $setvar
  7401. val="$vali"
  7402. set d_index; eval $setvar
  7403.  
  7404. : check whether inet_aton exists
  7405. set inet_aton d_inetaton
  7406. eval $inlibc
  7407.  
  7408. : Look for isascii
  7409. echo " "
  7410. $cat >isascii.c <<'EOCP'
  7411. #include <stdio.h>
  7412. #include <ctype.h>
  7413. main() {
  7414.     int c = 'A';
  7415.     if (isascii(c))
  7416.         exit(0);
  7417.     else
  7418.         exit(1);
  7419. }
  7420. EOCP
  7421. set isascii
  7422. if eval $compile; then
  7423.     echo "isascii() found." >&4
  7424.     val="$define"
  7425. else
  7426.     echo "isascii() NOT found." >&4
  7427.     val="$undef"
  7428. fi
  7429. set d_isascii
  7430. eval $setvar
  7431. $rm -f isascii*
  7432.  
  7433. : see if killpg exists
  7434. set killpg d_killpg
  7435. eval $inlibc
  7436.  
  7437. : see if lchown exists
  7438. echo " "
  7439. $cat > try.c <<'EOCP'
  7440. /* System header to define __stub macros and hopefully few prototypes,
  7441.     which can conflict with char lchown(); below.  */
  7442. #include <assert.h>
  7443. /* Override any gcc2 internal prototype to avoid an error.  */
  7444. /* We use char because int might match the return type of a gcc2
  7445.    builtin and then its argument prototype would still apply.  */
  7446. char lchown();
  7447. int main() {
  7448.     /*  The GNU C library defines this for functions which it implements
  7449.         to always fail with ENOSYS.  Some functions are actually named
  7450.     something starting with __ and the normal name is an alias.  */
  7451. #if defined (__stub_lchown) || defined (__stub___lchown)
  7452. choke me
  7453. #else
  7454. lchown();
  7455. #endif
  7456. ; return 0; }
  7457. EOCP
  7458. set try
  7459. if eval $compile; then
  7460.     $echo "lchown() found." >&4
  7461.     val="$define"
  7462. else
  7463.     $echo "lchown() NOT found." >&4
  7464.     val="$undef"
  7465. fi
  7466. set d_lchown
  7467. eval $setvar
  7468.  
  7469. : see if link exists
  7470. set link d_link
  7471. eval $inlibc
  7472.  
  7473. : see if localeconv exists
  7474. set localeconv d_locconv
  7475. eval $inlibc
  7476.  
  7477. : see if lockf exists
  7478. set lockf d_lockf
  7479. eval $inlibc
  7480.  
  7481. : check for long doubles
  7482. echo " "
  7483. echo $n "Checking to see if your system supports long doubles...$c" >&4
  7484. echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
  7485. if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
  7486.     val="$define"
  7487.     echo " Yup, it does." >&4
  7488. else
  7489.     val="$undef"
  7490.     echo " Nope, it doesn't." >&4
  7491. fi
  7492. $rm try.*
  7493. set d_longdbl
  7494. eval $setvar
  7495.  
  7496. : check for length of long double
  7497. case "${d_longdbl}${longdblsize}" in
  7498. $define)
  7499.     echo " "
  7500.     $echo $n "Checking to see how big your long doubles are...$c" >&4
  7501.     $cat >try.c <<'EOCP'
  7502. #include <stdio.h>
  7503. main()
  7504. {
  7505.     printf("%d\n", sizeof(long double));
  7506. }
  7507. EOCP
  7508.     set try
  7509.     if eval $compile; then
  7510.         longdblsize=`./try`
  7511.         $echo " $longdblsize bytes." >&4
  7512.     else
  7513.         dflt='8'
  7514.         echo " "
  7515.         echo "(I can't seem to compile the test program.  Guessing...)" >&4
  7516.         rp="What is the size of a long double (in bytes)?"
  7517.         . ./myread
  7518.         longdblsize="$ans"
  7519.     fi
  7520.     ;;
  7521. esac
  7522. $rm -f try.c try
  7523.  
  7524. : check for long long
  7525. echo " "
  7526. echo $n "Checking to see if your system supports long long...$c" >&4
  7527. echo 'long long foo() { long long x; x = 7; return x; }' > try.c
  7528. if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
  7529.     val="$define"
  7530.     echo " Yup, it does." >&4
  7531. else
  7532.     val="$undef"
  7533.     echo " Nope, it doesn't." >&4
  7534. fi
  7535. $rm try.*
  7536. set d_longlong
  7537. eval $setvar
  7538.  
  7539. : check for length of long long
  7540. case "${d_longlong}${longlongsize}" in
  7541. $define)
  7542.     echo " "
  7543.     $echo $n "Checking to see how big your long longs are...$c" >&4
  7544.     $cat >try.c <<'EOCP'
  7545. #include <stdio.h>
  7546. main()
  7547. {
  7548.     printf("%d\n", sizeof(long long));
  7549. }
  7550. EOCP
  7551.     set try
  7552.     if eval $compile_ok; then
  7553.         longlongsize=`./try`
  7554.         $echo " $longlongsize bytes." >&4
  7555.     else
  7556.         dflt='8'
  7557.         echo " "
  7558.         echo "(I can't seem to compile the test program.  Guessing...)"
  7559.         rp="What is the size of a long long (in bytes)?"
  7560.         . ./myread
  7561.         longlongsize="$ans"
  7562.     fi
  7563.     ;;
  7564. esac
  7565. $rm -f try.c try
  7566.  
  7567. : see if lstat exists
  7568. set lstat d_lstat
  7569. eval $inlibc
  7570.  
  7571. : see if mblen exists
  7572. set mblen d_mblen
  7573. eval $inlibc
  7574.  
  7575. : see if mbstowcs exists
  7576. set mbstowcs d_mbstowcs
  7577. eval $inlibc
  7578.  
  7579. : see if mbtowc exists
  7580. set mbtowc d_mbtowc
  7581. eval $inlibc
  7582.  
  7583. : see if memcmp exists
  7584. set memcmp d_memcmp
  7585. eval $inlibc
  7586.  
  7587. : see if memcpy exists
  7588. set memcpy d_memcpy
  7589. eval $inlibc
  7590.  
  7591. : see if memmove exists
  7592. set memmove d_memmove
  7593. eval $inlibc
  7594.  
  7595. : see if memset exists
  7596. set memset d_memset
  7597. eval $inlibc
  7598.  
  7599. : see if mkdir exists
  7600. set mkdir d_mkdir
  7601. eval $inlibc
  7602.  
  7603. : see if mkfifo exists
  7604. set mkfifo d_mkfifo
  7605. eval $inlibc
  7606.  
  7607. : see if mktime exists
  7608. set mktime d_mktime
  7609. eval $inlibc
  7610.  
  7611. : see if msgctl exists
  7612. set msgctl d_msgctl
  7613. eval $inlibc
  7614.  
  7615. : see if msgget exists
  7616. set msgget d_msgget
  7617. eval $inlibc
  7618.  
  7619. : see if msgsnd exists
  7620. set msgsnd d_msgsnd
  7621. eval $inlibc
  7622.  
  7623. : see if msgrcv exists
  7624. set msgrcv d_msgrcv
  7625. eval $inlibc
  7626.  
  7627. : see how much of the 'msg*(2)' library is present.
  7628. h_msg=true
  7629. echo " "
  7630. case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
  7631. *"$undef"*) h_msg=false;;
  7632. esac
  7633. : we could also check for sys/ipc.h ...
  7634. if $h_msg && $test `./findhdr sys/msg.h`; then
  7635.     echo "You have the full msg*(2) library." >&4
  7636.     val="$define"
  7637. else
  7638.     echo "You don't have the full msg*(2) library." >&4
  7639.     val="$undef"
  7640. fi
  7641. set d_msg
  7642. eval $setvar
  7643.  
  7644. : see if nice exists
  7645. set nice d_nice
  7646. eval $inlibc
  7647.  
  7648. : see if pause exists
  7649. set pause d_pause
  7650. eval $inlibc
  7651.  
  7652. : see if pipe exists
  7653. set pipe d_pipe
  7654. eval $inlibc
  7655.  
  7656. : see if poll exists
  7657. set poll d_poll
  7658. eval $inlibc
  7659.  
  7660.  
  7661. : see whether the various POSIXish _yields exist within given cccmd
  7662. $cat >try.c <<EOP
  7663. #include <pthread.h>
  7664. main() {
  7665.     YIELD();
  7666.     exit(0);
  7667. }
  7668. EOP
  7669. : see if pthread_yield exists within given cccmd,
  7670. : if we do not usethreads this may well end up undef.
  7671. set try -DYIELD=pthread_yield
  7672. if eval $compile; then
  7673.     val="$define"
  7674.     echo 'pthread_yield() found.' >&4
  7675. else
  7676.     val="$undef"
  7677.     echo 'pthread_yield() NOT found.' >&4
  7678. fi
  7679. set d_pthread_yield
  7680. eval $setvar
  7681.  
  7682. : see if sched_yield exists within given cccmd,
  7683. : if we do not usethreads this may well end up undef.
  7684. set try -DYIELD=sched_yield
  7685. if eval $compile; then
  7686.     val="$define"
  7687.     echo 'sched_yield() found.' >&4
  7688. else
  7689.     val="$undef"
  7690.     echo 'sched_yield() NOT found.' >&4
  7691. fi
  7692. set d_sched_yield
  7693. eval $setvar
  7694. $rm -f try try.*
  7695.  
  7696. : test whether pthreads are created in joinable -- aka undetached -- state
  7697. if test "X$usethreads" = "X$define"; then
  7698.     echo $n "Checking whether pthreads are created joinable. $c" >&4 
  7699.     $cat >try.c <<'EOCP'
  7700. #include <pthread.h>
  7701. #include <stdio.h>
  7702. int main() {
  7703.     pthread_attr_t attr;
  7704.     int detachstate;
  7705.     printf("%s\n",
  7706.     pthread_attr_init(&attr) == 0 &&
  7707.         pthread_attr_getdetachstate(&attr, &detachstate) == 0 &&
  7708.         detachstate == PTHREAD_CREATE_DETACHED ?
  7709.         "detached" : "joinable");
  7710.     exit(0);
  7711. }
  7712. EOCP
  7713.     set try
  7714.     if eval $compile; then
  7715.         yyy=`./try`
  7716.         case "$yyy" in
  7717.             detached) echo "Nope, they aren't." >&4 ;;
  7718.             *) echo "Yup, they are." >&4 ;;
  7719.         esac
  7720.     else
  7721.         echo " "
  7722.         echo "(I can't execute the test program--assuming they are.)" >&4
  7723.         yyy=joinable
  7724.     fi
  7725.     $rm -f try try.*
  7726.     case "$yyy" in
  7727.         detached) val="$undef" ;;
  7728.         *) val="$define" ;;
  7729.     esac
  7730.     set d_pthreads_created_joinable
  7731.     eval $setvar
  7732. else
  7733.     d_pthreads_created_joinable="$undef"
  7734. fi
  7735.  
  7736. : see if this is a pwd.h system
  7737. set pwd.h i_pwd
  7738. eval $inhdr
  7739.  
  7740. case "$i_pwd" in
  7741. $define)
  7742.     : see if setpwent exists
  7743.     set setpwent d_setpwent
  7744.     eval $inlibc
  7745.  
  7746.     : see if getpwent exists
  7747.     set getpwent d_getpwent
  7748.     eval $inlibc
  7749.  
  7750.     : see if endpwent exists
  7751.     set endpwent d_endpwent
  7752.     eval $inlibc
  7753.  
  7754.     xxx=`./findhdr pwd.h`
  7755.     $cppstdin $cppflags $cppminus < $xxx >$$.h
  7756.  
  7757.     if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
  7758.         val="$define"
  7759.     else
  7760.         val="$undef"
  7761.     fi
  7762.     set d_pwquota
  7763.     eval $setvar
  7764.  
  7765.     if $contains 'pw_age' $$.h >/dev/null 2>&1; then
  7766.         val="$define"
  7767.     else
  7768.         val="$undef"
  7769.     fi
  7770.     set d_pwage
  7771.     eval $setvar
  7772.  
  7773.     if $contains 'pw_change' $$.h >/dev/null 2>&1; then
  7774.         val="$define"
  7775.     else
  7776.         val="$undef"
  7777.     fi
  7778.     set d_pwchange
  7779.     eval $setvar
  7780.  
  7781.     if $contains 'pw_class' $$.h >/dev/null 2>&1; then
  7782.         val="$define"
  7783.     else
  7784.         val="$undef"
  7785.     fi
  7786.     set d_pwclass
  7787.     eval $setvar
  7788.  
  7789.     if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
  7790.         val="$define"
  7791.     else
  7792.         val="$undef"
  7793.     fi
  7794.     set d_pwexpire
  7795.     eval $setvar
  7796.  
  7797.     if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
  7798.         val="$define"
  7799.     else
  7800.         val="$undef"
  7801.     fi
  7802.     set d_pwcomment
  7803.     eval $setvar
  7804.  
  7805.     if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
  7806.         val="$define"
  7807.     else
  7808.         val="$undef"
  7809.     fi
  7810.     set d_pwgecos
  7811.     eval $setvar
  7812.  
  7813.     if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
  7814.         val="$define"
  7815.     else
  7816.         val="$undef"
  7817.     fi
  7818.     set d_pwpasswd
  7819.     eval $setvar
  7820.  
  7821.     $rm -f $$.h
  7822.     ;;
  7823. *)    # Assume all is lost as far as the d_*pw* go.
  7824.     val="$undef"; 
  7825.     set d_setpwent; eval $setvar
  7826.     set d_getpwent; eval $setvar
  7827.     set d_endpwent; eval $setvar
  7828.     set d_pwquota; eval $setvar
  7829.     set d_pwage; eval $setvar
  7830.     set d_pwchange; eval $setvar
  7831.     set d_pwclass; eval $setvar
  7832.     set d_pwexpire; eval $setvar
  7833.     set d_pwcomment; eval $setvar
  7834.     set d_pwgecos; eval $setvar
  7835.     set d_pwpasswd; eval $setvar
  7836.     ;;
  7837. esac
  7838.  
  7839. : see if readdir and friends exist
  7840. set readdir d_readdir
  7841. eval $inlibc
  7842. set seekdir d_seekdir
  7843. eval $inlibc
  7844. set telldir d_telldir
  7845. eval $inlibc
  7846. set rewinddir d_rewinddir
  7847. eval $inlibc
  7848.  
  7849. : see if readlink exists
  7850. set readlink d_readlink
  7851. eval $inlibc
  7852.  
  7853. : see if rename exists
  7854. set rename d_rename
  7855. eval $inlibc
  7856.  
  7857. : see if rmdir exists
  7858. set rmdir d_rmdir
  7859. eval $inlibc
  7860.  
  7861. : see if memory.h is available.
  7862. val=''
  7863. set memory.h val
  7864. eval $inhdr
  7865.  
  7866. : See if it conflicts with string.h
  7867. case "$val" in
  7868. $define)
  7869.     case "$strings" in
  7870.     '') ;;
  7871.     *)
  7872.         $cppstdin $cppflags $cppminus < $strings > mem.h
  7873.         if $contains 'memcpy' mem.h >/dev/null 2>&1; then
  7874.             echo " "
  7875.             echo "We won't be including <memory.h>."
  7876.             val="$undef"
  7877.         fi
  7878.         $rm -f mem.h
  7879.         ;;
  7880.     esac
  7881. esac
  7882. set i_memory
  7883. eval $setvar
  7884.  
  7885. : can bcopy handle overlapping blocks?
  7886. val="$undef"
  7887. case "$d_bcopy" in
  7888. "$define")
  7889.     echo " "
  7890.     echo "Checking to see if your bcopy() can do overlapping copies..." >&4
  7891.     $cat >try.c <<EOCP
  7892. #$i_memory I_MEMORY
  7893. #$i_stdlib I_STDLIB
  7894. #$i_string I_STRING
  7895. #$i_unistd I_UNISTD
  7896. EOCP
  7897.     $cat >>try.c <<'EOCP'
  7898. #include <stdio.h>
  7899. #ifdef I_MEMORY
  7900. #  include <memory.h>
  7901. #endif
  7902. #ifdef I_STDLIB
  7903. #  include <stdlib.h>
  7904. #endif
  7905. #ifdef I_STRING
  7906. #  include <string.h>
  7907. #else
  7908. #  include <strings.h>
  7909. #endif
  7910. #ifdef I_UNISTD
  7911. #  include <unistd.h>  /* Needed for NetBSD */
  7912. #endif
  7913. main()
  7914. {
  7915. char buf[128], abc[128];
  7916. char *b;
  7917. int len;
  7918. int off;
  7919. int align;
  7920.  
  7921. bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
  7922.  
  7923. for (align = 7; align >= 0; align--) {
  7924.     for (len = 36; len; len--) {
  7925.         b = buf+align;
  7926.         bcopy(abc, b, len);
  7927.         for (off = 1; off <= len; off++) {
  7928.             bcopy(b, b+off, len);
  7929.             bcopy(b+off, b, len);
  7930.             if (bcmp(b, abc, len))
  7931.                 exit(1);
  7932.         }
  7933.     }
  7934. }
  7935. exit(0);
  7936. }
  7937. EOCP
  7938.     set try
  7939.     if eval $compile_ok; then
  7940.         if ./try 2>/dev/null; then
  7941.             echo "Yes, it can."
  7942.             val="$define"
  7943.         else
  7944.             echo "It can't, sorry."
  7945.             case "$d_memmove" in
  7946.             "$define") echo "But that's Ok since you have memmove()." ;;
  7947.             esac
  7948.         fi
  7949.     else
  7950.         echo "(I can't compile the test program, so we'll assume not...)"
  7951.         case "$d_memmove" in
  7952.         "$define") echo "But that's Ok since you have memmove()." ;;
  7953.         esac
  7954.     fi
  7955.     ;;
  7956. esac
  7957. $rm -f try.* try core
  7958. set d_safebcpy
  7959. eval $setvar
  7960.  
  7961. : can memcpy handle overlapping blocks?
  7962. val="$undef"
  7963. case "$d_memcpy" in
  7964. "$define")
  7965.     echo " "
  7966.     echo "Checking to see if your memcpy() can do overlapping copies..." >&4
  7967.     $cat >try.c <<EOCP
  7968. #$i_memory I_MEMORY
  7969. #$i_stdlib I_STDLIB
  7970. #$i_string I_STRING
  7971. #$i_unistd I_UNISTD
  7972. EOCP
  7973.     $cat >>try.c <<'EOCP'
  7974. #include <stdio.h>
  7975. #ifdef I_MEMORY
  7976. #  include <memory.h>
  7977. #endif
  7978. #ifdef I_STDLIB
  7979. #  include <stdlib.h>
  7980. #endif
  7981. #ifdef I_STRING
  7982. #  include <string.h>
  7983. #else
  7984. #  include <strings.h>
  7985. #endif
  7986. #ifdef I_UNISTD
  7987. #  include <unistd.h>  /* Needed for NetBSD */
  7988. #endif
  7989. main()
  7990. {
  7991. char buf[128], abc[128];
  7992. char *b;
  7993. int len;
  7994. int off;
  7995. int align;
  7996.  
  7997. /* Copy "abcde..." string to char abc[] so that gcc doesn't
  7998.    try to store the string in read-only memory. */
  7999. memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
  8000.  
  8001. for (align = 7; align >= 0; align--) {
  8002.     for (len = 36; len; len--) {
  8003.         b = buf+align;
  8004.         memcpy(b, abc, len);
  8005.         for (off = 1; off <= len; off++) {
  8006.             memcpy(b+off, b, len);
  8007.             memcpy(b, b+off, len);
  8008.             if (memcmp(b, abc, len))
  8009.                 exit(1);
  8010.         }
  8011.     }
  8012. }
  8013. exit(0);
  8014. }
  8015. EOCP
  8016.     set try
  8017.     if eval $compile_ok; then
  8018.         if ./try 2>/dev/null; then
  8019.             echo "Yes, it can."
  8020.             val="$define"
  8021.         else
  8022.             echo "It can't, sorry."
  8023.             case "$d_memmove" in
  8024.             "$define") echo "But that's Ok since you have memmove()." ;;
  8025.             esac
  8026.         fi
  8027.     else
  8028.         echo "(I can't compile the test program, so we'll assume not...)"
  8029.         case "$d_memmove" in
  8030.         "$define") echo "But that's Ok since you have memmove()." ;;
  8031.         esac
  8032.     fi
  8033.     ;;
  8034. esac
  8035. $rm -f try.* try core
  8036. set d_safemcpy
  8037. eval $setvar
  8038.  
  8039. : can memcmp be trusted to compare relative magnitude?
  8040. val="$undef"
  8041. case "$d_memcmp" in
  8042. "$define")
  8043.     echo " "
  8044.     echo "Checking if your memcmp() can compare relative magnitude..." >&4
  8045.     $cat >try.c <<EOCP
  8046. #$i_memory I_MEMORY
  8047. #$i_stdlib I_STDLIB
  8048. #$i_string I_STRING
  8049. #$i_unistd I_UNISTD
  8050. EOCP
  8051.     $cat >>try.c <<'EOCP'
  8052. #include <stdio.h>
  8053. #ifdef I_MEMORY
  8054. #  include <memory.h>
  8055. #endif
  8056. #ifdef I_STDLIB
  8057. #  include <stdlib.h>
  8058. #endif
  8059. #ifdef I_STRING
  8060. #  include <string.h>
  8061. #else
  8062. #  include <strings.h>
  8063. #endif
  8064. #ifdef I_UNISTD
  8065. #  include <unistd.h>  /* Needed for NetBSD */
  8066. #endif
  8067. main()
  8068. {
  8069. char a = -1;
  8070. char b = 0;
  8071. if ((a < b) && memcmp(&a, &b, 1) < 0)
  8072.     exit(1);
  8073. exit(0);
  8074. }
  8075. EOCP
  8076.     set try
  8077.     if eval $compile_ok; then
  8078.         if ./try 2>/dev/null; then
  8079.             echo "Yes, it can."
  8080.             val="$define"
  8081.         else
  8082.             echo "No, it can't (it uses signed chars)."
  8083.         fi
  8084.     else
  8085.         echo "(I can't compile the test program, so we'll assume not...)"
  8086.     fi
  8087.     ;;
  8088. esac
  8089. $rm -f try.* try core
  8090. set d_sanemcmp
  8091. eval $setvar
  8092.  
  8093. : see if select exists
  8094. set select d_select
  8095. eval $inlibc
  8096.  
  8097. : see if semctl exists
  8098. set semctl d_semctl
  8099. eval $inlibc
  8100.  
  8101. : see if semget exists
  8102. set semget d_semget
  8103. eval $inlibc
  8104.  
  8105. : see if semop exists
  8106. set semop d_semop
  8107. eval $inlibc
  8108.  
  8109. : see how much of the 'sem*(2)' library is present.
  8110. h_sem=true
  8111. echo " "
  8112. case "$d_semctl$d_semget$d_semop" in
  8113. *"$undef"*) h_sem=false;;
  8114. esac
  8115. : we could also check for sys/ipc.h ...
  8116. if $h_sem && $test `./findhdr sys/sem.h`; then
  8117.     echo "You have the full sem*(2) library." >&4
  8118.     val="$define"
  8119. else
  8120.     echo "You don't have the full sem*(2) library." >&4
  8121.     val="$undef"
  8122. fi
  8123. set d_sem
  8124. eval $setvar
  8125.  
  8126. : see whether sys/sem.h defines union semun
  8127. echo " "
  8128. $cat > try.c <<'END'
  8129. #include <sys/types.h>
  8130. #include <sys/ipc.h>
  8131. #include <sys/sem.h>
  8132. int main () { union semun semun; semun.buf = 0; }
  8133. END
  8134. set try
  8135. if eval $compile; then
  8136.     echo "You have union semun in <sys/sem.h>." >&4
  8137.     val="$define"
  8138. else
  8139.     echo "You do not have union semun in <sys/sem.h>." >&4
  8140.     val="$undef"
  8141. fi
  8142. $rm -f try try.c
  8143. set d_union_semun
  8144. eval $setvar
  8145.  
  8146. : see how to do semctl IPC_STAT
  8147. case "$d_sem" in
  8148. $define)
  8149.     : see whether semctl IPC_STAT can use union semun
  8150.     echo " "
  8151.     $cat > try.c <<END
  8152. #include <sys/types.h>
  8153. #include <sys/ipc.h>
  8154. #include <sys/sem.h>
  8155. #include <sys/stat.h>
  8156. #include <stdio.h>
  8157. #include <errno.h>
  8158. #ifndef errno
  8159. extern int errno;
  8160. #endif
  8161. #$d_union_semun HAS_UNION_SEMUN
  8162. int main() {
  8163.     union semun
  8164. #ifndef HAS_UNION_SEMUN
  8165.     {
  8166.     int val;
  8167.     struct semid_ds *buf;
  8168.     unsigned short *array;
  8169.     }
  8170. #endif
  8171.     arg;
  8172.     int sem, st;
  8173.  
  8174. #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
  8175.     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
  8176.     if (sem > -1) {
  8177.     struct semid_ds argbuf;
  8178.     arg.buf = &argbuf;
  8179. #    ifdef IPC_STAT
  8180.     st = semctl(sem, 0, IPC_STAT, arg);
  8181.     if (st == 0)
  8182.         printf("semun\n");
  8183.     else
  8184. #    endif /* IPC_STAT */
  8185.         printf("semctl IPC_STAT failed: errno = %d\n", errno);
  8186. #    ifdef IPC_RMID
  8187.     if (semctl(sem, 0, IPC_RMID, arg) != 0)
  8188. #       endif /* IPC_RMID */
  8189.         printf("semctl IPC_RMID failed: errno = %d\n", errno);
  8190.     } else
  8191. #endif /* IPC_PRIVATE && ... */
  8192.     printf("semget failed: errno = %d\n", errno);
  8193.   return 0;
  8194. }
  8195. END
  8196.     val="$undef"
  8197.     set try
  8198.     if eval $compile; then
  8199.     xxx=`./try`
  8200.         case "$xxx" in
  8201.         semun) val="$define" ;;
  8202.         esac
  8203.     fi
  8204.     $rm -f try try.c
  8205.     set d_semctl_semun
  8206.     eval $setvar
  8207.     case "$d_semctl_semun" in
  8208.     $define)
  8209.         echo "You can use union semun for semctl IPC_STAT." >&4
  8210.     also='also'
  8211.         ;;
  8212.     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
  8213.     also=''
  8214.         ;;
  8215.     esac
  8216.  
  8217.     : see whether semctl IPC_STAT can use struct semid_ds pointer
  8218.     $cat > try.c <<'END'
  8219. #include <sys/types.h>
  8220. #include <sys/ipc.h>
  8221. #include <sys/sem.h>
  8222. #include <sys/stat.h>
  8223. #include <stdio.h>
  8224. #include <errno.h>
  8225. #ifndef errno
  8226. extern int errno;
  8227. #endif
  8228. int main() {
  8229.     struct semid_ds arg;
  8230.     int sem, st;
  8231.  
  8232. #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
  8233.     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
  8234.     if (sem > -1) {
  8235. #    ifdef IPC_STAT
  8236.     st = semctl(sem, 0, IPC_STAT, &arg);
  8237.     if (st == 0)
  8238.         printf("semid_ds\n");
  8239.     else
  8240. #    endif /* IPC_STAT */
  8241.         printf("semctl IPC_STAT failed: errno = %d\n", errno);
  8242. #    ifdef IPC_RMID
  8243.     if (semctl(sem, 0, IPC_RMID, &arg) != 0)
  8244. #    endif /* IPC_RMID */
  8245.         printf("semctl IPC_RMID failed: errno = %d\n", errno);
  8246.     } else
  8247. #endif /* IPC_PRIVATE && ... */
  8248.     printf("semget failed: errno = %d\n", errno);
  8249.  
  8250.     return 0;
  8251. }
  8252. END
  8253.     val="$undef"
  8254.     set try
  8255.     if eval $compile; then
  8256.         xxx=`./try`
  8257.         case "$xxx" in
  8258.         semid_ds) val="$define" ;;
  8259.         esac
  8260.     fi
  8261.     $rm -f try try.c
  8262.     set d_semctl_semid_ds
  8263.     eval $setvar
  8264.     case "$d_semctl_semid_ds" in
  8265.     $define)
  8266.         echo "You can $also use struct semid_ds * for semctl IPC_STAT." >&4
  8267.         ;;
  8268.     *)  echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4
  8269.         ;;
  8270.     esac
  8271.     ;;
  8272. *)  val="$undef"
  8273.  
  8274.     # We do not have the full sem*(2) library, so assume we can not
  8275.     # use either.
  8276.  
  8277.     set d_semctl_semun
  8278.     eval $setvar
  8279.  
  8280.     set d_semctl_semid_ds
  8281.     eval $setvar
  8282.     ;;
  8283. esac
  8284.  
  8285. : see if setegid exists
  8286. set setegid d_setegid
  8287. eval $inlibc
  8288.  
  8289. : see if seteuid exists
  8290. set seteuid d_seteuid
  8291. eval $inlibc
  8292.  
  8293. : see if sethostent exists
  8294. set sethostent d_sethent
  8295. eval $inlibc
  8296.  
  8297. : see if setlinebuf exists
  8298. set setlinebuf d_setlinebuf
  8299. eval $inlibc
  8300.  
  8301. : see if setlocale exists
  8302. set setlocale d_setlocale
  8303. eval $inlibc
  8304.  
  8305. : see if setnetent exists
  8306. set setnetent d_setnent
  8307. eval $inlibc
  8308.  
  8309. : see if setprotoent exists
  8310. set setprotoent d_setpent
  8311. eval $inlibc
  8312.  
  8313. : see if setpgid exists
  8314. set setpgid d_setpgid
  8315. eval $inlibc
  8316.  
  8317. : see if setpgrp2 exists
  8318. set setpgrp2 d_setpgrp2
  8319. eval $inlibc
  8320.  
  8321. : see if setpriority exists
  8322. set setpriority d_setprior
  8323. eval $inlibc
  8324.  
  8325. : see if setregid exists
  8326. set setregid d_setregid
  8327. eval $inlibc
  8328. set setresgid d_setresgid
  8329. eval $inlibc
  8330.  
  8331. : see if setreuid exists
  8332. set setreuid d_setreuid
  8333. eval $inlibc
  8334. set setresuid d_setresuid
  8335. eval $inlibc
  8336.  
  8337. : see if setrgid exists
  8338. set setrgid d_setrgid
  8339. eval $inlibc
  8340.  
  8341. : see if setruid exists
  8342. set setruid d_setruid
  8343. eval $inlibc
  8344.  
  8345. : see if setservent exists
  8346. set setservent d_setsent
  8347. eval $inlibc
  8348.  
  8349. : see if setsid exists
  8350. set setsid d_setsid
  8351. eval $inlibc
  8352.  
  8353. : see if setvbuf exists
  8354. set setvbuf d_setvbuf
  8355. eval $inlibc
  8356.  
  8357. : see if sfio.h is available
  8358. set sfio.h i_sfio
  8359. eval $inhdr
  8360.  
  8361.  
  8362. : see if sfio library is available
  8363. case "$i_sfio" in
  8364. $define)
  8365.     val=''
  8366.     set sfreserve val
  8367.     eval $inlibc
  8368.     ;;
  8369. *)
  8370.     val="$undef"
  8371.     ;;
  8372. esac
  8373. : Ok, but do we want to use it.
  8374. case "$val" in
  8375. $define)
  8376.     case "$usesfio" in
  8377.     true|$define|[yY]*) dflt='y';;
  8378.     *) dflt='n';;
  8379.     esac
  8380.     echo "$package can use the sfio library, but it is experimental."
  8381.     rp="You seem to have sfio available, do you want to try using it?"
  8382.     . ./myread
  8383.     case "$ans" in
  8384.     y|Y) ;;
  8385.     *)    echo "Ok, avoiding sfio this time.  I'll use stdio instead."
  8386.         val="$undef"
  8387.         : Remove sfio from list of libraries to use
  8388.         set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
  8389.         shift
  8390.         libs="$*"
  8391.         echo "libs = $libs" >&4
  8392.         ;;
  8393.     esac
  8394.     ;;
  8395. *)    case "$usesfio" in
  8396.     true|$define|[yY]*)
  8397.         echo "Sorry, cannot find sfio on this machine" >&4
  8398.         echo "Ignoring your setting of usesfio=$usesfio" >&4
  8399.         ;;
  8400.     esac
  8401.     ;;
  8402. esac
  8403. set d_sfio
  8404. eval $setvar
  8405. case "$d_sfio" in
  8406. $define) usesfio='true';;
  8407. *) usesfio='false';;
  8408. esac
  8409.  
  8410. : see if shmctl exists
  8411. set shmctl d_shmctl
  8412. eval $inlibc
  8413.  
  8414. : see if shmget exists
  8415. set shmget d_shmget
  8416. eval $inlibc
  8417.  
  8418. : see if shmat exists
  8419. set shmat d_shmat
  8420. eval $inlibc
  8421. : see what shmat returns
  8422. case "$d_shmat" in
  8423. "$define")
  8424.     $cat >shmat.c <<'END'
  8425. #include <sys/shm.h>
  8426. void *shmat();
  8427. END
  8428.     if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
  8429.         shmattype='void *'
  8430.     else
  8431.         shmattype='char *'
  8432.     fi
  8433.     echo "and it returns ($shmattype)." >&4
  8434.     : see if a prototype for shmat is available
  8435.     xxx=`./findhdr sys/shm.h`
  8436.     $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
  8437.     if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
  8438.         val="$define"
  8439.     else
  8440.         val="$undef"
  8441.     fi
  8442.     $rm -f shmat.[co]
  8443.     ;;
  8444. *)
  8445.     val="$undef"
  8446.     ;;
  8447. esac
  8448. set d_shmatprototype
  8449. eval $setvar
  8450.  
  8451. : see if shmdt exists
  8452. set shmdt d_shmdt
  8453. eval $inlibc
  8454.  
  8455. : see how much of the 'shm*(2)' library is present.
  8456. h_shm=true
  8457. echo " "
  8458. case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
  8459. *"$undef"*) h_shm=false;;
  8460. esac
  8461. : we could also check for sys/ipc.h ...
  8462. if $h_shm && $test `./findhdr sys/shm.h`; then
  8463.     echo "You have the full shm*(2) library." >&4
  8464.     val="$define"
  8465. else
  8466.     echo "You don't have the full shm*(2) library." >&4
  8467.     val="$undef"
  8468. fi
  8469. set d_shm
  8470. eval $setvar
  8471.  
  8472. echo " "
  8473. : see if we have sigaction
  8474. if set sigaction val -f d_sigaction; eval $csym; $val; then
  8475.     echo 'sigaction() found.' >&4
  8476.     $cat > try.c <<'EOP'
  8477. #include <stdio.h>
  8478. #include <sys/types.h>
  8479. #include <signal.h>
  8480. main()
  8481. {
  8482.     struct sigaction act, oact;
  8483. }
  8484. EOP
  8485.     set try
  8486.     if eval $compile_ok; then
  8487.         val="$define"
  8488.     else
  8489.         echo "But you don't seem to have a useable struct sigaction." >&4
  8490.         val="$undef"
  8491.     fi
  8492. else
  8493.     echo 'sigaction NOT found.' >&4
  8494.     val="$undef"
  8495. fi
  8496. set d_sigaction; eval $setvar
  8497. $rm -f try try$_o try.c
  8498.  
  8499. : see if sigsetjmp exists
  8500. echo " "
  8501. case "$d_sigsetjmp" in
  8502. '')
  8503.     $cat >try.c <<'EOP'
  8504. #include <setjmp.h>
  8505. sigjmp_buf env;
  8506. int set = 1;
  8507. main()
  8508. {
  8509.     if (sigsetjmp(env,1))
  8510.         exit(set);
  8511.     set = 0;
  8512.     siglongjmp(env, 1);
  8513.     exit(1);
  8514. }
  8515. EOP
  8516.     set try
  8517.     if eval $compile; then
  8518.         if ./try >/dev/null 2>&1; then
  8519.             echo "POSIX sigsetjmp found." >&4
  8520.             val="$define"
  8521.         else
  8522.             $cat >&4 <<EOM
  8523. Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
  8524. I'll ignore them.
  8525. EOM
  8526.             val="$undef"
  8527.         fi
  8528.     else
  8529.         echo "sigsetjmp not found." >&4
  8530.         val="$undef"
  8531.     fi
  8532.     ;;
  8533. *) val="$d_sigsetjmp"
  8534.     case "$d_sigsetjmp" in
  8535.     $define) echo "POSIX sigsetjmp found." >&4;;
  8536.     $undef) echo "sigsetjmp not found." >&4;;
  8537.     esac
  8538.     ;;
  8539. esac
  8540. set d_sigsetjmp
  8541. eval $setvar
  8542. $rm -f try.c try
  8543.  
  8544. socketlib=''
  8545. sockethdr=''
  8546. : see whether socket exists
  8547. echo " "
  8548. $echo $n "Hmm... $c" >&4
  8549. if set socket val -f d_socket; eval $csym; $val; then
  8550.     echo "Looks like you have Berkeley networking support." >&4
  8551.     d_socket="$define"
  8552.     if set setsockopt val -f; eval $csym; $val; then
  8553.         d_oldsock="$undef"
  8554.     else
  8555.         echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
  8556.         d_oldsock="$define"
  8557.     fi
  8558. else
  8559.     if $contains socklib libc.list >/dev/null 2>&1; then
  8560.         echo "Looks like you have Berkeley networking support." >&4
  8561.         d_socket="$define"
  8562.         : we will have to assume that it supports the 4.2 BSD interface
  8563.         d_oldsock="$undef"
  8564.     else
  8565.         echo "You don't have Berkeley networking in libc$_a..." >&4
  8566.         if test -f /usr/lib/libnet$_a; then
  8567.             ( ($nm $nm_opt /usr/lib/libnet$_a | eval $nm_extract) ||  \
  8568.             $ar t /usr/lib/libnet$_a) 2>/dev/null >> libc.list
  8569.             if $contains socket libc.list >/dev/null 2>&1; then
  8570.             echo "...but the Wollongong group seems to have hacked it in." >&4
  8571.                 socketlib="-lnet"
  8572.                 sockethdr="-I/usr/netinclude"
  8573.                 d_socket="$define"
  8574.                 if $contains setsockopt libc.list >/dev/null 2>&1; then
  8575.                     d_oldsock="$undef"
  8576.                 else
  8577.                     echo "...using the old 4.1c interface, rather than 4.2" >&4
  8578.                     d_oldsock="$define"
  8579.                 fi
  8580.             else
  8581.                 echo "or even in libnet$_a, which is peculiar." >&4
  8582.                 d_socket="$undef"
  8583.                 d_oldsock="$undef"
  8584.             fi
  8585.         else
  8586.             echo "or anywhere else I see." >&4
  8587.             d_socket="$undef"
  8588.             d_oldsock="$undef"
  8589.         fi
  8590.     fi
  8591. fi
  8592.  
  8593. : see if socketpair exists
  8594. set socketpair d_sockpair
  8595. eval $inlibc
  8596.  
  8597. : see if stat knows about block sizes
  8598. echo " "
  8599. xxx=`./findhdr sys/stat.h`
  8600. if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
  8601.     if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
  8602.         echo "Your stat() knows about block sizes." >&4
  8603.         val="$define"
  8604.     else
  8605.         echo "Your stat() doesn't know about block sizes." >&4
  8606.         val="$undef"
  8607.     fi
  8608. else
  8609.     echo "Your stat() doesn't know about block sizes." >&4
  8610.     val="$undef"
  8611. fi
  8612. set d_statblks
  8613. eval $setvar
  8614.  
  8615. : see if _ptr and _cnt from stdio act std
  8616. echo " "
  8617. if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
  8618.     echo "(Looks like you have stdio.h from Linux.)"
  8619.     case "$stdio_ptr" in
  8620.     '') stdio_ptr='((fp)->_IO_read_ptr)'
  8621.         ptr_lval=$define
  8622.         ;;
  8623.     *)    ptr_lval=$d_stdio_ptr_lval;;
  8624.     esac
  8625.     case "$stdio_cnt" in
  8626.     '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
  8627.         cnt_lval=$undef
  8628.         ;;
  8629.     *)    cnt_lval=$d_stdio_cnt_lval;;
  8630.     esac
  8631.     case "$stdio_base" in
  8632.     '') stdio_base='((fp)->_IO_read_base)';;
  8633.     esac
  8634.     case "$stdio_bufsiz" in
  8635.     '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
  8636.     esac
  8637. else
  8638.     case "$stdio_ptr" in
  8639.     '') stdio_ptr='((fp)->_ptr)'
  8640.         ptr_lval=$define
  8641.         ;;
  8642.     *)    ptr_lval=$d_stdio_ptr_lval;;
  8643.     esac
  8644.     case "$stdio_cnt" in
  8645.     '') stdio_cnt='((fp)->_cnt)'
  8646.         cnt_lval=$define
  8647.         ;;
  8648.     *)    cnt_lval=$d_stdio_cnt_lval;;
  8649.     esac
  8650.     case "$stdio_base" in
  8651.     '') stdio_base='((fp)->_base)';;
  8652.     esac
  8653.     case "$stdio_bufsiz" in
  8654.     '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
  8655.     esac
  8656. fi
  8657. : test whether _ptr and _cnt really work
  8658. echo "Checking how std your stdio is..." >&4
  8659. $cat >try.c <<EOP
  8660. #include <stdio.h>
  8661. #define FILE_ptr(fp)    $stdio_ptr
  8662. #define FILE_cnt(fp)    $stdio_cnt
  8663. main() {
  8664.     FILE *fp = fopen("try.c", "r");
  8665.     char c = getc(fp);
  8666.     if (
  8667.         18 <= FILE_cnt(fp) &&
  8668.         strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
  8669.     )
  8670.         exit(0);
  8671.     exit(1);
  8672. }
  8673. EOP
  8674. val="$undef"
  8675. set try
  8676. if eval $compile; then
  8677.     if ./try; then
  8678.         echo "Your stdio acts pretty std."
  8679.         val="$define"
  8680.     else
  8681.         echo "Your stdio isn't very std."
  8682.     fi
  8683. else
  8684.     echo "Your stdio doesn't appear very std."
  8685. fi
  8686. $rm -f try.c try
  8687. set d_stdstdio
  8688. eval $setvar
  8689.  
  8690. : Can _ptr be used as an lvalue?
  8691. case "$d_stdstdio$ptr_lval" in
  8692. $define$define) val=$define ;;
  8693. *) val=$undef ;;
  8694. esac
  8695. set d_stdio_ptr_lval
  8696. eval $setvar
  8697.  
  8698. : Can _cnt be used as an lvalue?
  8699. case "$d_stdstdio$cnt_lval" in
  8700. $define$define) val=$define ;;
  8701. *) val=$undef ;;
  8702. esac
  8703. set d_stdio_cnt_lval
  8704. eval $setvar
  8705.  
  8706. : see if _base is also standard
  8707. val="$undef"
  8708. case "$d_stdstdio" in
  8709. $define)
  8710.     $cat >try.c <<EOP
  8711. #include <stdio.h>
  8712. #define FILE_base(fp)    $stdio_base
  8713. #define FILE_bufsiz(fp)    $stdio_bufsiz
  8714. main() {
  8715.     FILE *fp = fopen("try.c", "r");
  8716.     char c = getc(fp);
  8717.     if (
  8718.         19 <= FILE_bufsiz(fp) &&
  8719.         strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
  8720.     )
  8721.         exit(0);
  8722.     exit(1);
  8723. }
  8724. EOP
  8725.     set try
  8726.     if eval $compile; then
  8727.         if ./try; then
  8728.             echo "And its _base field acts std."
  8729.             val="$define"
  8730.         else
  8731.             echo "But its _base field isn't std."
  8732.         fi
  8733.     else
  8734.         echo "However, it seems to be lacking the _base field."
  8735.     fi
  8736.     $rm -f try.c try
  8737.     ;;
  8738. esac
  8739. set d_stdiobase
  8740. eval $setvar
  8741.  
  8742. : see if strcoll exists
  8743. set strcoll d_strcoll
  8744. eval $inlibc
  8745.  
  8746. : check for structure copying
  8747. echo " "
  8748. echo "Checking to see if your C compiler can copy structs..." >&4
  8749. $cat >try.c <<'EOCP'
  8750. main()
  8751. {
  8752.     struct blurfl {
  8753.         int dyick;
  8754.     } foo, bar;
  8755.  
  8756.     foo = bar;
  8757. }
  8758. EOCP
  8759. if $cc -c try.c >/dev/null 2>&1 ; then
  8760.     val="$define"
  8761.     echo "Yup, it can."
  8762. else
  8763.     val="$undef"
  8764.     echo "Nope, it can't."
  8765. fi
  8766. set d_strctcpy
  8767. eval $setvar
  8768. $rm -f try.*
  8769.  
  8770. : see if strerror and/or sys_errlist[] exist
  8771. echo " "
  8772. if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
  8773.     if set strerror val -f d_strerror; eval $csym; $val; then
  8774.     echo 'strerror() found.' >&4
  8775.     d_strerror="$define"
  8776.     d_strerrm='strerror(e)'
  8777.     if set sys_errlist val -a d_syserrlst; eval $csym; $val; then    
  8778.         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
  8779.         d_syserrlst="$define"
  8780.     else
  8781.         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
  8782.         d_syserrlst="$undef"
  8783.     fi
  8784.     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
  8785.     $contains '#[     ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
  8786.     echo 'strerror() found in string header.' >&4
  8787.     d_strerror="$define"
  8788.     d_strerrm='strerror(e)'
  8789.     if set sys_errlist val -a d_syserrlst; eval $csym; $val; then    
  8790.     echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
  8791.         d_syserrlst="$define"
  8792.     else
  8793.         echo "(You don't appear to have any sys_errlist[], how can this be?)"
  8794.     d_syserrlst="$undef"
  8795.     fi
  8796.     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
  8797. echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
  8798.     d_strerror="$undef"
  8799.     d_syserrlst="$define"
  8800.     d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
  8801.     else
  8802.     echo 'strerror() and sys_errlist[] NOT found.' >&4
  8803.     d_strerror="$undef"
  8804.     d_syserrlst="$undef"
  8805.     d_strerrm='"unknown"'
  8806.     fi
  8807. fi
  8808.  
  8809. : see if strtod exists
  8810. set strtod d_strtod
  8811. eval $inlibc
  8812.  
  8813. : see if strtol exists
  8814. set strtol d_strtol
  8815. eval $inlibc
  8816.  
  8817. : see if strtoul exists
  8818. set strtoul d_strtoul
  8819. eval $inlibc
  8820.  
  8821. : see if strxfrm exists
  8822. set strxfrm d_strxfrm
  8823. eval $inlibc
  8824.  
  8825. : see if symlink exists
  8826. set symlink d_symlink
  8827. eval $inlibc
  8828.  
  8829. : see if syscall exists
  8830. set syscall d_syscall
  8831. eval $inlibc
  8832.  
  8833. : see if sysconf exists
  8834. set sysconf d_sysconf
  8835. eval $inlibc
  8836.  
  8837. : see if system exists
  8838. set system d_system
  8839. eval $inlibc
  8840.  
  8841. : see if tcgetpgrp exists
  8842. set tcgetpgrp d_tcgetpgrp
  8843. eval $inlibc
  8844.  
  8845. : see if tcsetpgrp exists
  8846. set tcsetpgrp d_tcsetpgrp
  8847. eval $inlibc
  8848.  
  8849. : define an is-a-typedef? function
  8850. typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
  8851. case "$inclist" in
  8852. "") inclist="sys/types.h";;
  8853. esac;
  8854. eval "varval=\$$var";
  8855. case "$varval" in
  8856. "")
  8857.     $rm -f temp.c;
  8858.     for inc in $inclist; do
  8859.         echo "#include <$inc>" >>temp.c;
  8860.     done;
  8861.     echo "#ifdef $type" >> temp.c;
  8862.     echo "printf(\"We have $type\");" >> temp.c;
  8863.     echo "#endif" >> temp.c;
  8864.     $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
  8865.     if $contains $type temp.E >/dev/null 2>&1; then
  8866.         eval "$var=\$type";
  8867.     else
  8868.         eval "$var=\$def";
  8869.     fi;
  8870.     $rm -f temp.?;;
  8871. *) eval "$var=\$varval";;
  8872. esac'
  8873.  
  8874. : define an is-a-typedef? function that prompts if the type is not available.
  8875. typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
  8876. case "$inclist" in
  8877. "") inclist="sys/types.h";;
  8878. esac;
  8879. eval "varval=\$$var";
  8880. case "$varval" in
  8881. "")
  8882.     $rm -f temp.c;
  8883.     for inc in $inclist; do
  8884.         echo "#include <$inc>" >>temp.c;
  8885.     done;
  8886.     echo "#ifdef $type" >> temp.c;
  8887.     echo "printf(\"We have $type\");" >> temp.c;
  8888.     echo "#endif" >> temp.c;
  8889.     $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
  8890.     echo " " ;
  8891.     echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
  8892.     if $contains $type temp.E >/dev/null 2>&1; then
  8893.         echo "$type found." >&4;
  8894.         eval "$var=\$type";
  8895.     else
  8896.         echo "$type NOT found." >&4;
  8897.         dflt="$def";
  8898.         . ./myread ;
  8899.         eval "$var=\$ans";
  8900.     fi;
  8901.     $rm -f temp.?;;
  8902. *) eval "$var=\$varval";;
  8903. esac'
  8904.  
  8905. : see if this is a sys/times.h system
  8906. set sys/times.h i_systimes
  8907. eval $inhdr
  8908.  
  8909. : see if times exists
  8910. echo " "
  8911. if set times val -f d_times; eval $csym; $val; then
  8912.     echo 'times() found.' >&4
  8913.     d_times="$define"
  8914.     inc=''
  8915.     case "$i_systimes" in
  8916.     "$define") inc='sys/times.h';;
  8917.     esac
  8918.     rp="What is the type returned by times() on this system?"
  8919.     set clock_t clocktype long stdio.h sys/types.h $inc
  8920.     eval $typedef_ask
  8921. else
  8922.     echo 'times() NOT found, hope that will do.' >&4
  8923.     d_times="$undef"
  8924.     clocktype='int'
  8925. fi
  8926.  
  8927. : see if truncate exists
  8928. set truncate d_truncate
  8929. eval $inlibc
  8930.  
  8931. : see if tzname[] exists
  8932. echo " "
  8933. if set tzname val -a d_tzname; eval $csym; $val; then
  8934.     val="$define"
  8935.     echo 'tzname[] found.' >&4
  8936. else
  8937.     val="$undef"
  8938.     echo 'tzname[] NOT found.' >&4
  8939. fi
  8940. set d_tzname
  8941. eval $setvar
  8942.  
  8943. : see if umask exists
  8944. set umask d_umask
  8945. eval $inlibc
  8946.  
  8947. : see how we will look up host name
  8948. echo " "
  8949. if false; then
  8950.     : dummy stub to allow use of elif
  8951. elif set uname val -f d_uname; eval $csym; $val; then
  8952.     if ./xenix; then
  8953.         $cat <<'EOM'
  8954. uname() was found, but you're running xenix, and older versions of xenix
  8955. have a broken uname(). If you don't really know whether your xenix is old
  8956. enough to have a broken system call, use the default answer.
  8957.  
  8958. EOM
  8959.         dflt=y
  8960.         case "$d_uname" in
  8961.         "$define") dflt=n;;
  8962.         esac
  8963.         rp='Is your uname() broken?'
  8964.         . ./myread
  8965.         case "$ans" in
  8966.         n*) d_uname="$define"; call=uname;;
  8967.         esac
  8968.     else
  8969.         echo 'uname() found.' >&4
  8970.         d_uname="$define"
  8971.         call=uname
  8972.     fi
  8973. fi
  8974. case "$d_gethname" in
  8975. '') d_gethname="$undef";;
  8976. esac
  8977. case "$d_uname" in
  8978. '') d_uname="$undef";;
  8979. esac
  8980. case "$d_phostname" in
  8981. '') d_phostname="$undef";;
  8982. esac
  8983.  
  8984. : backward compatibility for d_hvfork
  8985. if test X$d_hvfork != X; then
  8986.     d_vfork="$d_hvfork"
  8987.     d_hvfork=''
  8988. fi
  8989. : see if there is a vfork
  8990. val=''
  8991. set vfork val
  8992. eval $inlibc
  8993.  
  8994. : Ok, but do we want to use it. vfork is reportedly unreliable in 
  8995. : perl on Solaris 2.x, and probably elsewhere.
  8996. case "$val" in
  8997. $define)
  8998.     echo " "
  8999.     case "$usevfork" in
  9000.     false) dflt='n';;
  9001.     *) dflt='y';;
  9002.     esac
  9003.     rp="Some systems have problems with vfork().  Do you want to use it?"
  9004.     . ./myread
  9005.     case "$ans" in
  9006.     y|Y) ;;
  9007.     *)
  9008.         echo "Ok, we won't use vfork()."
  9009.         val="$undef"
  9010.         ;;
  9011.     esac
  9012.     ;;
  9013. esac
  9014. set d_vfork
  9015. eval $setvar
  9016. case "$d_vfork" in
  9017. $define) usevfork='true';;
  9018. *) usevfork='false';;
  9019. esac
  9020.  
  9021. : see if this is an sysdir system
  9022. set sys/dir.h i_sysdir
  9023. eval $inhdr
  9024.  
  9025. : see if this is an sysndir system
  9026. set sys/ndir.h i_sysndir
  9027. eval $inhdr
  9028.  
  9029. : see if sys/types.h has to be included
  9030. set sys/types.h i_systypes
  9031. eval $inhdr
  9032.  
  9033. : see if closedir exists
  9034. set closedir d_closedir
  9035. eval $inlibc
  9036.  
  9037. case "$d_closedir" in
  9038. "$define")
  9039.     echo " "
  9040.     echo "Checking whether closedir() returns a status..." >&4
  9041.     cat > closedir.c <<EOM
  9042. #$i_dirent I_DIRENT        /**/
  9043. #$i_sysdir I_SYS_DIR        /**/
  9044. #$i_sysndir I_SYS_NDIR        /**/
  9045. #$i_systypes I_SYS_TYPES    /**/
  9046.  
  9047. #if defined(I_SYS_TYPES)
  9048. #include <sys/types.h>
  9049. #endif
  9050. #if defined(I_DIRENT)
  9051. #include <dirent.h>
  9052. #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
  9053. #include <sys/dir.h>
  9054. #endif
  9055. #else
  9056. #ifdef I_SYS_NDIR
  9057. #include <sys/ndir.h>
  9058. #else
  9059. #ifdef I_SYS_DIR
  9060. #ifdef hp9000s500
  9061. #include <ndir.h>    /* may be wrong in the future */
  9062. #else
  9063. #include <sys/dir.h>
  9064. #endif
  9065. #endif
  9066. #endif
  9067. #endif 
  9068. int main() { return closedir(opendir(".")); }
  9069. EOM
  9070.     set closedir
  9071.     if eval $compile_ok; then
  9072.         if ./closedir > /dev/null 2>&1 ; then
  9073.             echo "Yes, it does."
  9074.             val="$undef"
  9075.         else
  9076.             echo "No, it doesn't."
  9077.             val="$define"
  9078.         fi
  9079.     else
  9080.         echo "(I can't seem to compile the test program--assuming it doesn't)"
  9081.         val="$define"
  9082.     fi
  9083.     ;;
  9084. *)
  9085.     val="$undef";
  9086.     ;;
  9087. esac
  9088. set d_void_closedir
  9089. eval $setvar
  9090. $rm -f closedir*
  9091. : check for volatile keyword
  9092. echo " "
  9093. echo 'Checking to see if your C compiler knows about "volatile"...' >&4
  9094. $cat >try.c <<'EOCP'
  9095. main()
  9096. {
  9097.     typedef struct _goo_struct goo_struct;
  9098.     goo_struct * volatile goo = ((goo_struct *)0);
  9099.     struct _goo_struct {
  9100.         long long_int;
  9101.         int reg_int;
  9102.         char char_var;
  9103.     };
  9104.     typedef unsigned short foo_t;
  9105.     char *volatile foo;
  9106.     volatile int bar;
  9107.     volatile foo_t blech;
  9108.     foo = foo;
  9109. }
  9110. EOCP
  9111. if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
  9112.     val="$define"
  9113.     echo "Yup, it does."
  9114. else
  9115.     val="$undef"
  9116.     echo "Nope, it doesn't."
  9117. fi
  9118. set d_volatile
  9119. eval $setvar
  9120. $rm -f try.*
  9121.  
  9122. : see if there is a wait4
  9123. set wait4 d_wait4
  9124. eval $inlibc
  9125.  
  9126. : see if waitpid exists
  9127. set waitpid d_waitpid
  9128. eval $inlibc
  9129.  
  9130. : see if wcstombs exists
  9131. set wcstombs d_wcstombs
  9132. eval $inlibc
  9133.  
  9134. : see if wctomb exists
  9135. set wctomb d_wctomb
  9136. eval $inlibc
  9137.  
  9138. : preserve RCS keywords in files with variable substitution, grrr
  9139. Date='$Date'
  9140. Id='$Id'
  9141. Log='$Log'
  9142. RCSfile='$RCSfile'
  9143. Revision='$Revision'
  9144.  
  9145. : check for alignment requirements
  9146. echo " "
  9147. case "$alignbytes" in
  9148. '') echo "Checking alignment constraints..." >&4
  9149.     $cat >try.c <<'EOCP'
  9150. struct foobar {
  9151.     char foo;
  9152.     double bar;
  9153. } try;
  9154. main()
  9155. {
  9156.     printf("%d\n", (char *)&try.bar - (char *)&try.foo);
  9157. }
  9158. EOCP
  9159.     set try
  9160.     if eval $compile_ok; then
  9161.         dflt=`./try`
  9162.     else
  9163.         dflt='8'
  9164.         echo "(I can't seem to compile the test program...)"
  9165.     fi
  9166.     ;;
  9167. *) dflt="$alignbytes"
  9168.     ;;
  9169. esac
  9170. rp="Doubles must be aligned on a how-many-byte boundary?"
  9171. . ./myread
  9172. alignbytes="$ans"
  9173. $rm -f try.c try
  9174.  
  9175. : check for ordering of bytes in a long
  9176. case "$byteorder" in
  9177. '')
  9178.     $cat <<'EOM'
  9179.   
  9180. In the following, larger digits indicate more significance.  A big-endian
  9181. machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
  9182. little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
  9183. machines may have weird orders like 3412.  A Cray will report 87654321. If
  9184. the test program works the default is probably right.
  9185. I'm now running the test program...
  9186. EOM
  9187.     $cat >try.c <<'EOCP'
  9188. #include <stdio.h>
  9189. main()
  9190. {
  9191.     int i;
  9192.     union {
  9193.         unsigned long l;
  9194.         char c[sizeof(long)];
  9195.     } u;
  9196.  
  9197.     if (sizeof(long) > 4)
  9198.         u.l = (0x08070605L << 32) | 0x04030201L;
  9199.     else
  9200.         u.l = 0x04030201L;
  9201.     for (i = 0; i < sizeof(long); i++)
  9202.         printf("%c", u.c[i]+'0');
  9203.     printf("\n");
  9204.     exit(0);
  9205. }
  9206. EOCP
  9207.     xxx_prompt=y
  9208.     set try
  9209.     if eval $compile && ./try > /dev/null; then
  9210.         dflt=`./try`
  9211.         case "$dflt" in
  9212.         [1-4][1-4][1-4][1-4]|12345678|87654321)
  9213.             echo "(The test program ran ok.)"
  9214.             echo "byteorder=$dflt"
  9215.             xxx_prompt=n
  9216.             ;;
  9217.         ????|????????) echo "(The test program ran ok.)" ;;
  9218.         *) echo "(The test program didn't run right for some reason.)" ;;
  9219.         esac
  9220.     else
  9221.         dflt='4321'
  9222.         cat <<'EOM'
  9223. (I can't seem to compile the test program.  Guessing big-endian...)
  9224. EOM
  9225.     fi
  9226.     case "$xxx_prompt" in
  9227.     y)
  9228.         rp="What is the order of bytes in a long?"
  9229.         . ./myread
  9230.         byteorder="$ans"
  9231.         ;;
  9232.     *)    byteorder=$dflt
  9233.         ;;
  9234.     esac
  9235.     ;;
  9236. esac
  9237. $rm -f try.c try
  9238.  
  9239. : how do we catenate cpp tokens here?
  9240. echo " "
  9241. echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
  9242. $cat >cpp_stuff.c <<'EOCP'
  9243. #define RCAT(a,b)a/**/b
  9244. #define ACAT(a,b)a ## b
  9245. RCAT(Rei,ser)
  9246. ACAT(Cir,cus)
  9247. EOCP
  9248. $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
  9249. if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
  9250.     echo "Oh!  Smells like ANSI's been here." >&4
  9251.     echo "We can catify or stringify, separately or together!"
  9252.     cpp_stuff=42
  9253. elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
  9254.     echo "Ah, yes!  The good old days!" >&4
  9255.     echo "However, in the good old days we don't know how to stringify and"
  9256.     echo "catify at the same time."
  9257.     cpp_stuff=1
  9258. else
  9259.     $cat >&4 <<EOM
  9260. Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
  9261. to have to edit the values of CAT[2-5] in config.h...
  9262. EOM
  9263.     cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
  9264. fi
  9265. $rm -f cpp_stuff.*
  9266.  
  9267. : see if this is a db.h system
  9268. set db.h i_db
  9269. eval $inhdr
  9270.  
  9271. case "$i_db" in
  9272. $define)
  9273.     : Check db version.
  9274.     echo " "
  9275.     echo "Checking Berkeley DB version ..." >&4
  9276.     $cat >try.c <<EOCP
  9277. #$d_const HASCONST
  9278. #ifndef HASCONST
  9279. #define const
  9280. #endif
  9281. #include <sys/types.h>
  9282. #include <stdio.h>
  9283. #include <db.h>
  9284. main()
  9285. {
  9286. #ifdef DB_VERSION_MAJOR    /* DB version >= 2 */
  9287.     int Major, Minor, Patch ;
  9288.     unsigned long Version ;
  9289.     (void)db_version(&Major, &Minor, &Patch) ;
  9290.     printf("You have Berkeley DB Version 2 or greater\n");
  9291.  
  9292.     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
  9293.         DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
  9294.     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
  9295.         Major, Minor, Patch) ;
  9296.  
  9297.     /* check that db.h & libdb are compatible */
  9298.     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
  9299.     printf("db.h and libdb are incompatible\n") ;
  9300.         exit(3);    
  9301.     }
  9302.  
  9303.     printf("db.h and libdb are compatible\n") ;
  9304.  
  9305.     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
  9306.         + DB_VERSION_PATCH ;
  9307.  
  9308.     /* needs to be >= 2.3.4 */
  9309.     if (Version < 2003004) {
  9310.     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
  9311.     printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
  9312.         exit(2);    
  9313.     }
  9314.  
  9315.     exit(0);
  9316. #else
  9317. #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
  9318.     printf("You have Berkeley DB Version 1\n");
  9319.     exit(0);    /* DB version < 2: the coast is clear. */
  9320. #else
  9321.     exit(1);    /* <db.h> not Berkeley DB? */
  9322. #endif
  9323. #endif
  9324. }
  9325. EOCP
  9326.     set try
  9327.     if eval $compile && ./try; then
  9328.         echo 'Looks OK.' >&4
  9329.     else
  9330.         echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
  9331.         i_db=$undef
  9332.         case " $libs " in
  9333.         *"-ldb "*)
  9334.             : Remove db from list of libraries to use
  9335.             echo "Removing unusable -ldb from library list" >&4
  9336.             set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
  9337.             shift
  9338.             libs="$*"
  9339.             echo "libs = $libs" >&4
  9340.             ;;
  9341.         esac
  9342.     fi
  9343.     $rm -f try.*
  9344.     ;;
  9345. esac
  9346.  
  9347. case "$i_db" in
  9348. define)
  9349.     : Check the return type needed for hash 
  9350.     echo " "
  9351.     echo "Checking return type needed for hash for Berkeley DB ..." >&4
  9352.     $cat >try.c <<EOCP
  9353. #$d_const HASCONST
  9354. #ifndef HASCONST
  9355. #define const
  9356. #endif
  9357. #include <sys/types.h>
  9358. #include <db.h>
  9359.  
  9360. #ifndef DB_VERSION_MAJOR
  9361. u_int32_t hash_cb (ptr, size)
  9362. const void *ptr;
  9363. size_t size;
  9364. {
  9365. }
  9366. HASHINFO info;
  9367. main()
  9368. {
  9369.     info.hash = hash_cb;
  9370. }
  9371. #endif
  9372. EOCP
  9373.     if $cc $ccflags -c try.c >try.out 2>&1 ; then
  9374.         if $contains warning try.out >>/dev/null 2>&1 ; then
  9375.             db_hashtype='int'
  9376.         else
  9377.             db_hashtype='u_int32_t'
  9378.         fi
  9379.     else
  9380.         : XXX Maybe we should just give up here.
  9381.         db_hashtype=u_int32_t
  9382.         $cat try.out >&4
  9383.         echo "Help:  I can't seem to compile the db test program." >&4
  9384.         echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
  9385.     fi
  9386.     $rm -f try.*
  9387.     echo "Your version of Berkeley DB uses $db_hashtype for hash."
  9388.     ;;
  9389. *)    db_hashtype=u_int32_t
  9390.     ;;
  9391. esac
  9392. case "$i_db" in
  9393. define)
  9394.     : Check the return type needed for prefix 
  9395.     echo " "
  9396.     echo "Checking return type needed for prefix for Berkeley DB ..." >&4
  9397.     cat >try.c <<EOCP
  9398. #$d_const HASCONST
  9399. #ifndef HASCONST
  9400. #define const
  9401. #endif
  9402. #include <sys/types.h>
  9403. #include <db.h>
  9404.  
  9405. #ifndef DB_VERSION_MAJOR
  9406. size_t prefix_cb (key1, key2)
  9407. const DBT *key1;
  9408. const DBT *key2;
  9409. {
  9410. }
  9411. BTREEINFO info;
  9412. main()
  9413. {
  9414.     info.prefix = prefix_cb;
  9415. }
  9416. #endif
  9417. EOCP
  9418.     if $cc $ccflags -c try.c  >try.out 2>&1 ; then
  9419.         if $contains warning try.out >>/dev/null 2>&1 ; then
  9420.             db_prefixtype='int'
  9421.         else
  9422.             db_prefixtype='size_t'
  9423.         fi
  9424.     else
  9425.         db_prefixtype='size_t'
  9426.         : XXX Maybe we should just give up here.
  9427.         $cat try.out >&4
  9428.         echo "Help:  I can't seem to compile the db test program." >&4
  9429.         echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
  9430.     fi
  9431.     $rm -f try.*
  9432.     echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
  9433.     ;;
  9434. *)    db_prefixtype='size_t'
  9435.     ;;
  9436. esac
  9437.  
  9438. : check for void type
  9439. echo " "
  9440. echo "Checking to see how well your C compiler groks the void type..." >&4
  9441. case "$voidflags" in
  9442. '')
  9443.     $cat >try.c <<'EOCP'
  9444. #if TRY & 1
  9445. void sub() {
  9446. #else
  9447. sub() {
  9448. #endif
  9449.     extern void moo();    /* function returning void */
  9450.     void (*goo)();        /* ptr to func returning void */
  9451. #if TRY & 8
  9452.     void *hue;        /* generic ptr */
  9453. #endif
  9454. #if TRY & 2
  9455.     void (*foo[10])();
  9456. #endif
  9457.  
  9458. #if TRY & 4
  9459.     if(goo == moo) {
  9460.         exit(0);
  9461.     }
  9462. #endif
  9463.     exit(0);
  9464. }
  9465. main() { sub(); }
  9466. EOCP
  9467.     if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
  9468.         voidflags=$defvoidused
  9469.     echo "Good.  It appears to support void to the level $package wants.">&4
  9470.         if $contains warning .out >/dev/null 2>&1; then
  9471.             echo "However, you might get some warnings that look like this:"
  9472.             $cat .out
  9473.         fi
  9474.     else
  9475. echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
  9476.         if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
  9477.             echo "It supports 1..."
  9478.             if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
  9479.                 echo "It also supports 2..."
  9480.                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
  9481.                     voidflags=7
  9482.                     echo "And it supports 4 but not 8 definitely."
  9483.                 else
  9484.                     echo "It doesn't support 4..."
  9485.                     if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
  9486.                         voidflags=11
  9487.                         echo "But it supports 8."
  9488.                     else
  9489.                         voidflags=3
  9490.                         echo "Neither does it support 8."
  9491.                     fi
  9492.                 fi
  9493.             else
  9494.                 echo "It does not support 2..."
  9495.                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
  9496.                     voidflags=13
  9497.                     echo "But it supports 4 and 8."
  9498.                 else
  9499.                     if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
  9500.                         voidflags=5
  9501.                         echo "And it supports 4 but has not heard about 8."
  9502.                     else
  9503.                         echo "However it supports 8 but not 4."
  9504.                     fi
  9505.                 fi
  9506.             fi
  9507.         else
  9508.             echo "There is no support at all for void."
  9509.             voidflags=0
  9510.         fi
  9511.     fi
  9512. esac
  9513. case "$voidflags" in
  9514. "$defvoidused") ;;
  9515. *)    $cat >&4 <<'EOM'
  9516.   Support flag bits are:
  9517.     1: basic void declarations.
  9518.     2: arrays of pointers to functions returning void.
  9519.     4: operations between pointers to and addresses of void functions.
  9520.     8: generic void pointers.
  9521. EOM
  9522.     dflt="$voidflags";
  9523.     rp="Your void support flags add up to what?"
  9524.     . ./myread
  9525.     voidflags="$ans"
  9526.     ;;
  9527. esac
  9528. $rm -f try.* .out
  9529.  
  9530. : check for length of double
  9531. echo " "
  9532. case "$doublesize" in
  9533. '')
  9534.     $echo $n "Checking to see how big your double precision numbers are...$c" >&4
  9535.     $cat >try.c <<'EOCP'
  9536. #include <stdio.h>
  9537. main()
  9538. {
  9539.     printf("%d\n", sizeof(double));
  9540. }
  9541. EOCP
  9542.     set try
  9543.     if eval $compile_ok; then
  9544.         doublesize=`./try`
  9545.         $echo " $doublesize bytes." >&4
  9546.     else
  9547.         dflt='8'
  9548.         echo "(I can't seem to compile the test program.  Guessing...)"
  9549.         rp="What is the size of a double precision number (in bytes)?"
  9550.         . ./myread
  9551.         doublesize="$ans"
  9552.     fi
  9553.     ;;
  9554. esac
  9555. $rm -f try.c try
  9556.  
  9557. : see what type file positions are declared as in the library
  9558. rp="What is the type for file position used by fsetpos()?"
  9559. set fpos_t fpostype long stdio.h sys/types.h
  9560. eval $typedef_ask
  9561.  
  9562. : get csh whereabouts
  9563. case "$csh" in
  9564. 'csh') val="$undef" ;;
  9565. *) val="$define" ;;
  9566. esac
  9567. set d_csh
  9568. eval $setvar
  9569. : Respect a hint or command line value for full_csh.
  9570. case "$full_csh" in
  9571. '') full_csh=$csh ;;
  9572. esac
  9573.  
  9574. : Store the full pathname to the sed program for use in the C program
  9575. full_sed=$sed
  9576.  
  9577. : see what type gids are declared as in the kernel
  9578. echo " "
  9579. echo "Looking for the type for group ids returned by getgid()."
  9580. set gid_t gidtype xxx stdio.h sys/types.h
  9581. eval $typedef
  9582. case "$gidtype" in
  9583. xxx)
  9584.     xxx=`./findhdr sys/user.h`
  9585.     set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
  9586.     case $1 in
  9587.     unsigned) dflt="$1 $2" ;;
  9588.     *) dflt="$1" ;;
  9589.     esac
  9590.     ;;
  9591. *) dflt="$gidtype";;
  9592. esac
  9593. case "$gidtype" in
  9594. gid_t) echo "gid_t found." ;;
  9595. *)    rp="What is the type for group ids returned by getgid()?"
  9596.     . ./myread
  9597.     gidtype="$ans"
  9598.     ;;
  9599. esac
  9600.  
  9601. : see if getgroups exists
  9602. set getgroups d_getgrps
  9603. eval $inlibc
  9604.  
  9605. : see if setgroups exists
  9606. set setgroups d_setgrps
  9607. eval $inlibc
  9608.  
  9609.  
  9610. : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
  9611. echo " "
  9612. case "$d_getgrps$d_setgrps" in
  9613. *define*)
  9614.     case "$groupstype" in
  9615.     '') dflt="$gidtype" ;;
  9616.     *)  dflt="$groupstype" ;;
  9617.     esac
  9618.     $cat <<EOM
  9619. What type of pointer is the second argument to getgroups() and setgroups()?
  9620. Usually this is the same as group ids, $gidtype, but not always.
  9621.  
  9622. EOM
  9623.     rp='What type pointer is the second argument to getgroups() and setgroups()?'
  9624.     . ./myread
  9625.     groupstype="$ans"
  9626.     ;;
  9627. *)  groupstype="$gidtype";;
  9628. esac
  9629.  
  9630. : see what type lseek is declared as in the kernel
  9631. rp="What is the type used for lseek's offset on this system?"
  9632. set off_t lseektype long stdio.h sys/types.h
  9633. eval $typedef_ask
  9634.  
  9635. echo " "
  9636. echo "Checking if your $make program sets \$(MAKE)..." >&4
  9637. case "$make_set_make" in
  9638. '')
  9639.     $sed 's/^X //' > testmake.mak << 'EOF'
  9640. Xall:
  9641. X     @echo 'maketemp="$(MAKE)"'
  9642. EOF
  9643.     case "`$make -f testmake.mak 2>/dev/null`" in
  9644.     *maketemp=*) make_set_make='#' ;;
  9645.     *)    make_set_make="MAKE=$make" ;;
  9646.     esac
  9647.     $rm -f testmake.mak
  9648.     ;;
  9649. esac
  9650. case "$make_set_make" in
  9651. '#') echo "Yup, it does.";;
  9652. *) echo "Nope, it doesn't.";;
  9653. esac
  9654.  
  9655. : see what type is used for mode_t
  9656. rp="What is the type used for file modes for system calls (e.g. fchmod())?"
  9657. set mode_t modetype int stdio.h sys/types.h
  9658. eval $typedef_ask
  9659.  
  9660. : define a fucntion to check prototypes
  9661. $cat > protochk <<EOSH
  9662. $startsh
  9663. cc="$cc"
  9664. optimize="$optimize"
  9665. ccflags="$ccflags"
  9666. prototype="$prototype"
  9667. define="$define"
  9668. rm=$rm
  9669. EOSH
  9670.  
  9671. $cat >> protochk <<'EOSH'
  9672.  
  9673. $rm -f try.c
  9674. foo="$1"
  9675. shift
  9676. while test $# -ge 2; do
  9677.     case "$1" in
  9678.         $define) echo "#include <$2>" >> try.c ;;
  9679.         literal) echo "$2" >> try.c ;;
  9680.     esac
  9681.     shift 2
  9682. done
  9683. test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
  9684. cat >> try.c <<'EOCP'
  9685. #ifdef CAN_PROTOTYPE
  9686. #define    _(args) args
  9687. #else
  9688. #define    _(args) ()
  9689. #endif
  9690. EOCP
  9691. echo "$foo" >> try.c
  9692. echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
  9693. $cc $optimize $ccflags -c try.c > /dev/null 2>&1
  9694. status=$?
  9695. $rm -f try.[co]
  9696. exit $status
  9697. EOSH
  9698. chmod +x protochk
  9699. $eunicefix protochk
  9700.  
  9701. : see what type is used for size_t
  9702. rp="What is the type used for the length parameter for string functions?"
  9703. set size_t sizetype 'unsigned int' stdio.h sys/types.h
  9704. eval $typedef_ask
  9705.  
  9706. : check for type of arguments to gethostbyaddr. 
  9707. if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
  9708.     case "$d_gethbyaddr" in
  9709.     $define)
  9710.         $cat <<EOM
  9711.  
  9712. Checking to see what type of arguments are accepted by gethostbyaddr().
  9713. EOM
  9714.         hdrs="$define sys/types.h
  9715.             $d_socket sys/socket.h 
  9716.             $i_niin netinet/in.h 
  9717.             $i_netdb netdb.h
  9718.             $i_unistd unistd.h"
  9719.         : The first arg can 'char *' or 'void *'
  9720.         : The second arg is some of integral type
  9721.         for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
  9722.             for yyy in size_t long int; do
  9723.                 case "$netdb_host_type" in
  9724.                 '')    try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
  9725.                     if ./protochk "$try" $hdrs; then
  9726.                         echo "Your system accepts $xxx for the first arg."
  9727.                         echo "...and $yyy for the second arg."
  9728.                         netdb_host_type="$xxx"
  9729.                         netdb_hlen_type="$yyy"
  9730.                     fi
  9731.                     ;;
  9732.                 esac
  9733.             done
  9734.         done
  9735.         : In case none of those worked, prompt the user.
  9736.         case "$netdb_host_type" in
  9737.         '')    rp='What is the type for the 1st argument to gethostbyaddr?'
  9738.             dflt='char *'
  9739.             . ./myread
  9740.             netdb_host_type=$ans
  9741.             rp='What is the type for the 2nd argument to gethostbyaddr?'
  9742.             dflt="$sizetype"
  9743.             . ./myread
  9744.             netdb_hlen_type=$ans
  9745.             ;;
  9746.         esac
  9747.         ;;
  9748.     *)    : no gethostbyaddr, so pick harmless defaults
  9749.         netdb_host_type='char *'
  9750.         netdb_hlen_type="$sizetype"
  9751.         ;;
  9752.     esac
  9753.     # Remove the "const" if needed. -- but then we'll have a 
  9754.     # prototype clash!
  9755.     # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
  9756. fi
  9757.  
  9758. : check for type of argument to gethostbyname. 
  9759. if test "X$netdb_name_type" = X ; then
  9760.     case "$d_gethbyname" in
  9761.     $define)
  9762.         $cat <<EOM
  9763.  
  9764. Checking to see what type of argument is accepted by gethostbyname().
  9765. EOM
  9766.         hdrs="$define sys/types.h
  9767.             $d_socket sys/socket.h 
  9768.             $i_niin netinet/in.h 
  9769.             $i_netdb netdb.h
  9770.             $i_unistd unistd.h"
  9771.         for xxx in "const char *" "char *"; do
  9772.             case "$netdb_name_type" in
  9773.             '')    try="extern struct hostent *gethostbyname($xxx);"
  9774.                 if ./protochk "$try" $hdrs; then
  9775.                     echo "Your system accepts $xxx."
  9776.                     netdb_name_type="$xxx"
  9777.                 fi
  9778.                 ;;
  9779.             esac
  9780.         done
  9781.         : In case none of those worked, prompt the user.
  9782.         case "$netdb_name_type" in
  9783.         '')    rp='What is the type for the 1st argument to gethostbyname?'
  9784.             dflt='char *'
  9785.             . ./myread
  9786.             netdb_name_type=$ans
  9787.             ;;
  9788.         esac
  9789.         ;;
  9790.     *)    : no gethostbyname, so pick harmless default
  9791.         netdb_name_type='char *'
  9792.         ;;
  9793.     esac
  9794. fi
  9795.  
  9796. : check for type of 1st argument to getnetbyaddr. 
  9797. if test "X$netdb_net_type" = X ; then
  9798.     case "$d_getnbyaddr" in
  9799.     $define)
  9800.         $cat <<EOM
  9801.  
  9802. Checking to see what type of 1st argument is accepted by getnetbyaddr().
  9803. EOM
  9804.         hdrs="$define sys/types.h
  9805.             $d_socket sys/socket.h 
  9806.             $i_niin netinet/in.h 
  9807.             $i_netdb netdb.h
  9808.             $i_unistd unistd.h"
  9809.         for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
  9810.             case "$netdb_net_type" in
  9811.             '')    try="extern struct netent *getnetbyaddr($xxx, int);"
  9812.                 if ./protochk "$try" $hdrs; then
  9813.                     echo "Your system accepts $xxx."
  9814.                     netdb_net_type="$xxx"
  9815.                 fi
  9816.                 ;;
  9817.             esac
  9818.         done
  9819.         : In case none of those worked, prompt the user.
  9820.         case "$netdb_net_type" in
  9821.         '')    rp='What is the type for the 1st argument to getnetbyaddr?'
  9822.             dflt='long'
  9823.             . ./myread
  9824.             netdb_net_type=$ans
  9825.             ;;
  9826.         esac
  9827.         ;;
  9828.     *)    : no getnetbyaddr, so pick harmless default
  9829.         netdb_net_type='long'
  9830.         ;;
  9831.     esac
  9832. fi
  9833. : locate the preferred pager for this system
  9834. case "$pager" in
  9835. '')
  9836.     dflt=''
  9837.     case "$pg" in
  9838.     /*) dflt=$pg;;
  9839.     esac
  9840.     case "$more" in
  9841.     /*) dflt=$more;;
  9842.     esac
  9843.     case "$less" in
  9844.     /*) dflt=$less;;
  9845.     esac
  9846.     case "$dflt" in
  9847.     '') dflt=/usr/ucb/more;;
  9848.     esac
  9849.     ;;
  9850. *) dflt="$pager";;
  9851. esac
  9852. echo " "
  9853. fn=f/
  9854. rp='What pager is used on your system?'
  9855. . ./getfile
  9856. pager="$ans"
  9857.  
  9858. : see what type pids are declared as in the kernel
  9859. rp="What is the type of process ids on this system?"
  9860. set pid_t pidtype int stdio.h sys/types.h
  9861. eval $typedef_ask
  9862.  
  9863. : check for length of pointer
  9864. echo " "
  9865. case "$ptrsize" in
  9866. '')
  9867.     $echo $n "Checking to see how big your pointers are...$c" >&4
  9868.     if test "$voidflags" -gt 7; then
  9869.         echo '#define VOID_PTR char *' > try.c
  9870.     else
  9871.         echo '#define VOID_PTR void *' > try.c
  9872.     fi
  9873.     $cat >>try.c <<'EOCP'
  9874. #include <stdio.h>
  9875. main()
  9876. {
  9877.     printf("%d\n", sizeof(VOID_PTR));
  9878.     exit(0);
  9879. }
  9880. EOCP
  9881.     set try
  9882.     if eval $compile_ok; then
  9883.         ptrsize=`./try`
  9884.         $echo " $ptrsize bytes." >&4
  9885.     else
  9886.         dflt='4'
  9887.         echo "(I can't seem to compile the test program.  Guessing...)" >&4
  9888.         rp="What is the size of a pointer (in bytes)?"
  9889.         . ./myread
  9890.         ptrsize="$ans"
  9891.     fi
  9892.     ;;
  9893. esac
  9894. $rm -f try.c try
  9895.  
  9896. : check for size of random number generator
  9897. echo " "
  9898. case "$randbits" in
  9899. '')
  9900.     echo "Checking to see how many bits your rand function produces..." >&4
  9901.     $cat >try.c <<EOCP
  9902. #$i_unistd I_UNISTD
  9903. #$i_stdlib I_STDLIB
  9904. #include <stdio.h>
  9905. #ifdef I_UNISTD
  9906. #  include <unistd.h>
  9907. #endif
  9908. #ifdef I_STDLIB
  9909. #  include <stdlib.h>
  9910. #endif
  9911. EOCP
  9912.     $cat >>try.c <<'EOCP'
  9913. main()
  9914. {
  9915.     register int i;
  9916.     register unsigned long tmp;
  9917.     register unsigned long max = 0L;
  9918.  
  9919.     for (i = 1000; i; i--) {
  9920.         tmp = (unsigned long)rand();
  9921.         if (tmp > max) max = tmp;
  9922.     }
  9923.     for (i = 0; max; i++)
  9924.         max /= 2;
  9925.     printf("%d\n",i);
  9926. }
  9927. EOCP
  9928.     set try
  9929.     if eval $compile_ok; then
  9930.         dflt=`./try$_exe`
  9931.     else
  9932.         dflt='?'
  9933.         echo "(I can't seem to compile the test program...)"
  9934.     fi
  9935.     ;;
  9936. *)
  9937.     dflt="$randbits"
  9938.     ;;
  9939. esac
  9940. rp='How many bits does your rand() function produce?'
  9941. . ./myread
  9942. randbits="$ans"
  9943. $rm -f try.* try
  9944.  
  9945. : see if ar generates random libraries by itself
  9946. echo " "
  9947. echo "Checking how to generate random libraries on your machine..." >&4
  9948. echo 'int bar1() { return bar2(); }' > bar1.c
  9949. echo 'int bar2() { return 2; }' > bar2.c
  9950. $cat > foo.c <<'EOP'
  9951. main() { printf("%d\n", bar1()); exit(0); }
  9952. EOP
  9953. $cc $ccflags -c bar1.c >/dev/null 2>&1
  9954. $cc $ccflags -c bar2.c >/dev/null 2>&1
  9955. $cc $ccflags -c foo.c >/dev/null 2>&1
  9956. $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
  9957. if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
  9958.     ./foobar >/dev/null 2>&1; then
  9959.     echo "$ar appears to generate random libraries itself."
  9960.     orderlib=false
  9961.     ranlib=":"
  9962. elif $ar ts bar$_a >/dev/null 2>&1 &&
  9963.     $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
  9964.     ./foobar >/dev/null 2>&1; then
  9965.         echo "a table of contents needs to be added with '$ar ts'."
  9966.         orderlib=false
  9967.         ranlib="$ar ts"
  9968. else
  9969.     case "$ranlib" in
  9970.     :) ranlib='';;
  9971.     '')
  9972.         ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
  9973.         $test -f $ranlib || ranlib=''
  9974.         ;;
  9975.     esac
  9976.     if $test -n "$ranlib"; then
  9977.         echo "your system has '$ranlib'; we'll use that."
  9978.         orderlib=false
  9979.     else
  9980.         echo "your system doesn't seem to support random libraries"
  9981.         echo "so we'll use lorder and tsort to order the libraries."
  9982.         orderlib=true
  9983.         ranlib=":"
  9984.     fi
  9985. fi
  9986. $rm -f foo* bar* 
  9987.  
  9988. : see if sys/select.h has to be included
  9989. set sys/select.h i_sysselct
  9990. eval $inhdr
  9991.  
  9992. : see if we should include time.h, sys/time.h, or both
  9993. echo " "
  9994. if test "X$timeincl" = X; then
  9995.     echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
  9996.     $echo $n "I'm now running the test program...$c"
  9997.     $cat >try.c <<'EOCP'
  9998. #include <sys/types.h>
  9999. #ifdef I_TIME
  10000. #include <time.h>
  10001. #endif
  10002. #ifdef I_SYSTIME
  10003. #ifdef SYSTIMEKERNEL
  10004. #define KERNEL
  10005. #endif
  10006. #include <sys/time.h>
  10007. #endif
  10008. #ifdef I_SYSSELECT
  10009. #include <sys/select.h>
  10010. #endif
  10011. main()
  10012. {
  10013.     struct tm foo;
  10014. #ifdef S_TIMEVAL
  10015.     struct timeval bar;
  10016. #endif
  10017. #ifdef S_TIMEZONE
  10018.     struct timezone tzp;
  10019. #endif
  10020.     if (foo.tm_sec == foo.tm_sec)
  10021.         exit(0);
  10022. #ifdef S_TIMEVAL
  10023.     if (bar.tv_sec == bar.tv_sec)
  10024.         exit(0);
  10025. #endif
  10026.     exit(1);
  10027. }
  10028. EOCP
  10029.     flags=''
  10030.     for s_timezone in '-DS_TIMEZONE' ''; do
  10031.     sysselect=''
  10032.     for s_timeval in '-DS_TIMEVAL' ''; do
  10033.     for i_systimek in '' '-DSYSTIMEKERNEL'; do
  10034.     for i_time in '' '-DI_TIME'; do
  10035.     for i_systime in '-DI_SYSTIME' ''; do
  10036.     case "$flags" in
  10037.     '') $echo $n ".$c"
  10038.         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
  10039.         if eval $compile; then
  10040.                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
  10041.             shift
  10042.             flags="$*"
  10043.             echo " "
  10044.             $echo $n "Succeeded with $flags$c"
  10045.         fi
  10046.         ;;
  10047.     esac
  10048.     done
  10049.     done
  10050.     done
  10051.     done
  10052.     done
  10053.     timeincl=''
  10054.     echo " "
  10055.     case "$flags" in
  10056.     *SYSTIMEKERNEL*) i_systimek="$define"
  10057.     timeincl=`./findhdr sys/time.h`
  10058.     echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
  10059.     *) i_systimek="$undef";;
  10060.     esac
  10061.     case "$flags" in
  10062.     *I_TIME*) i_time="$define"
  10063.     timeincl=`./findhdr time.h`" $timeincl"
  10064.     echo "We'll include <time.h>." >&4;;
  10065.     *) i_time="$undef";;
  10066.     esac
  10067.     case "$flags" in
  10068.     *I_SYSTIME*) i_systime="$define"
  10069.     timeincl=`./findhdr sys/time.h`" $timeincl"
  10070.     echo "We'll include <sys/time.h>." >&4;;
  10071.     *) i_systime="$undef";;
  10072.     esac
  10073.     $rm -f try.c try
  10074. fi
  10075.  
  10076. : check for fd_set items
  10077. $cat <<EOM
  10078.  
  10079. Checking to see how well your C compiler handles fd_set and friends ...
  10080. EOM
  10081. $cat >fd_set.c <<EOCP
  10082. #$i_systime I_SYS_TIME
  10083. #$i_sysselct I_SYS_SELECT
  10084. #$d_socket HAS_SOCKET
  10085. #include <sys/types.h>
  10086. #ifdef HAS_SOCKET
  10087. #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
  10088. #endif
  10089. #ifdef I_SYS_TIME
  10090. #include <sys/time.h>
  10091. #endif
  10092. #ifdef I_SYS_SELECT
  10093. #include <sys/select.h>
  10094. #endif
  10095. main() {
  10096.     fd_set fds;
  10097.  
  10098. #ifdef TRYBITS
  10099.     if(fds.fds_bits);
  10100. #endif
  10101.  
  10102. #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
  10103.     exit(0);
  10104. #else
  10105.     exit(1);
  10106. #endif
  10107. }
  10108. EOCP
  10109. set fd_set -DTRYBITS
  10110. if eval $compile; then
  10111.     d_fds_bits="$define"
  10112.     d_fd_set="$define"
  10113.     echo "Well, your system knows about the normal fd_set typedef..." >&4
  10114.     if ./fd_set; then
  10115.         echo "and you have the normal fd_set macros (just as I'd expect)." >&4
  10116.         d_fd_macros="$define"
  10117.     else
  10118.         $cat >&4 <<'EOM'
  10119. but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
  10120. EOM
  10121.         d_fd_macros="$undef"
  10122.     fi
  10123. else
  10124.     $cat <<'EOM'
  10125. Hmm, your compiler has some difficulty with fd_set.  Checking further...
  10126. EOM
  10127.     set fd_set
  10128.     if eval $compile; then
  10129.         d_fds_bits="$undef"
  10130.         d_fd_set="$define"
  10131.         echo "Well, your system has some sort of fd_set available..." >&4
  10132.         if ./fd_set; then
  10133.             echo "and you have the normal fd_set macros." >&4
  10134.             d_fd_macros="$define"
  10135.         else
  10136.             $cat <<'EOM'
  10137. but not the normal fd_set macros!  Gross!  More work for me...
  10138. EOM
  10139.             d_fd_macros="$undef"
  10140.         fi
  10141.     else
  10142.     echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
  10143.         d_fd_set="$undef"
  10144.         d_fds_bits="$undef"
  10145.         d_fd_macros="$undef"
  10146.     fi
  10147. fi
  10148. $rm -f fd_set*
  10149.  
  10150. : check for type of arguments to select. 
  10151. case "$selecttype" in
  10152. '') case "$d_select" in
  10153.     $define)
  10154.         $cat <<EOM
  10155. Checking to see what type of arguments are accepted by select().
  10156. EOM
  10157.         hdrs="$define sys/types.h
  10158.             $i_systime sys/time.h 
  10159.             $i_sysselct sys/select.h
  10160.             $d_socket sys/socket.h"
  10161.         : The first arg can be int, unsigned, or size_t
  10162.         : The last arg may or may not be 'const'
  10163.         val=''
  10164.         for xxx in 'fd_set *' 'int *'; do
  10165.             for nfd in 'int' 'size_t' 'unsigned' ; do
  10166.                 for tmo in 'struct timeval *' 'const struct timeval *'; do
  10167.                     case "$val" in
  10168.                     '')    try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
  10169.                         if ./protochk "$try" $hdrs; then
  10170.                             echo "Your system accepts $xxx."
  10171.                             val="$xxx"
  10172.                         fi
  10173.                         ;;
  10174.                     esac
  10175.                 done
  10176.             done
  10177.         done
  10178.         case "$val" in
  10179.         '')    rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
  10180.             case "$d_fd_set" in
  10181.                 $define) dflt="fd_set *" ;;
  10182.                 *)        dflt="int *" ;;
  10183.             esac
  10184.             . ./myread
  10185.             val=$ans
  10186.             ;;
  10187.         esac
  10188.         selecttype="$val"
  10189.         ;;
  10190.     *)    : no select, so pick a harmless default
  10191.         selecttype='int *'
  10192.         ;;
  10193.     esac
  10194.     ;;
  10195. esac
  10196.  
  10197. : Trace out the files included by signal.h, then look for SIGxxx names.
  10198. : Remove SIGARRAYSIZE used by HPUX.
  10199. : Remove SIGTYP void lines used by OS2.
  10200. xxx=`echo '#include <signal.h>' |
  10201.     $cppstdin $cppminus $cppflags 2>/dev/null |
  10202.     $grep '^[     ]*#.*include' | 
  10203.     $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
  10204. : Check this list of files to be sure we have parsed the cpp output ok.
  10205. : This will also avoid potentially non-existent files, such 
  10206. : as ../foo/bar.h
  10207. xxxfiles=''
  10208. for xx in $xxx /dev/null ; do
  10209.     $test -f "$xx" && xxxfiles="$xxxfiles $xx"
  10210. done
  10211. : If we have found no files, at least try signal.h
  10212. case "$xxxfiles" in
  10213. '')    xxxfiles=`./findhdr signal.h` ;;
  10214. esac
  10215. xxx=`awk '
  10216. $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
  10217.     print substr($2, 4, 20)
  10218. }
  10219. $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
  10220.     print substr($3, 4, 20)
  10221. }' $xxxfiles`
  10222. : Append some common names just in case the awk scan failed.
  10223. xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
  10224. xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
  10225. xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
  10226. xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
  10227. : generate a few handy files for later
  10228. $cat > signal.c <<'EOCP'
  10229. #include <sys/types.h>
  10230. #include <signal.h>
  10231. #include <stdio.h>
  10232. int main() {
  10233.  
  10234. /* Strange style to avoid deeply-nested #if/#else/#endif */
  10235. #ifndef NSIG
  10236. #  ifdef _NSIG
  10237. #    define NSIG (_NSIG)
  10238. #  endif
  10239. #endif
  10240.  
  10241. #ifndef NSIG
  10242. #  ifdef SIGMAX
  10243. #    define NSIG (SIGMAX+1)
  10244. #  endif
  10245. #endif
  10246.  
  10247. #ifndef NSIG
  10248. #  ifdef SIG_MAX
  10249. #    define NSIG (SIG_MAX+1)
  10250. #  endif
  10251. #endif
  10252.  
  10253. #ifndef NSIG
  10254. #  ifdef MAXSIG
  10255. #    define NSIG (MAXSIG+1)
  10256. #  endif
  10257. #endif
  10258.  
  10259. #ifndef NSIG
  10260. #  ifdef MAX_SIG
  10261. #    define NSIG (MAX_SIG+1)
  10262. #  endif
  10263. #endif
  10264.  
  10265. #ifndef NSIG
  10266. #  ifdef SIGARRAYSIZE
  10267. #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
  10268. #  endif
  10269. #endif
  10270.  
  10271. #ifndef NSIG
  10272. #  ifdef _sys_nsig
  10273. #    define NSIG (_sys_nsig) /* Solaris 2.5 */
  10274. #  endif
  10275. #endif
  10276.  
  10277. /* Default to some arbitrary number that's big enough to get most
  10278.    of the common signals.
  10279. */
  10280. #ifndef NSIG
  10281. #    define NSIG 50
  10282. #endif
  10283.  
  10284. printf("NSIG %d\n", NSIG);
  10285.  
  10286. #ifndef JUST_NSIG
  10287.  
  10288. EOCP
  10289.  
  10290. echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
  10291. {
  10292.     printf "#ifdef SIG"; printf $1; printf "\n"
  10293.     printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
  10294.     printf $1; printf ");\n"
  10295.     printf "#endif\n"
  10296. }
  10297. END {
  10298.     printf "#endif /* JUST_NSIG */\n";
  10299.     printf "}\n";
  10300. }
  10301. ' >>signal.c
  10302. $cat >signal.awk <<'EOP'
  10303. BEGIN { ndups = 0 }
  10304. $1 ~ /^NSIG$/ { nsig = $2 }
  10305. ($1 !~ /^NSIG$/) && (NF == 2) {
  10306.     if ($2 > maxsig) { maxsig = $2 }
  10307.     if (sig_name[$2]) {
  10308.     dup_name[ndups] = $1
  10309.     dup_num[ndups] = $2
  10310.     ndups++ 
  10311.     }
  10312.     else {
  10313.     sig_name[$2] = $1
  10314.     sig_num[$2] = $2
  10315.     }
  10316.  
  10317. }
  10318. END { 
  10319.     if (nsig == 0) { nsig = maxsig + 1 }
  10320.     for (n = 1; n < nsig; n++) {
  10321.         if (sig_name[n]) {
  10322.             printf("%s %d\n", sig_name[n], sig_num[n])
  10323.         }
  10324.         else {
  10325.             printf("NUM%d %d\n", n, n) 
  10326.         }
  10327.     }
  10328.     for (n = 0; n < ndups; n++) {
  10329.         printf("%s %d\n", dup_name[n], dup_num[n])
  10330.     }
  10331. }
  10332. EOP
  10333. $cat >signal_cmd <<EOS
  10334. $startsh
  10335. if $test -s signal.lst; then
  10336.     echo "Using your existing signal.lst file"
  10337.     exit 0
  10338. fi
  10339. xxx="$xxx"
  10340. EOS
  10341. $cat >>signal_cmd <<'EOS'
  10342.  
  10343. set signal
  10344. if eval $compile_ok; then
  10345.     ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
  10346. else
  10347.     echo "(I can't seem be able to compile the whole test program)" >&4
  10348.     echo "(I'll try it in little pieces.)" >&4
  10349.     set signal -DJUST_NSIG
  10350.     if eval $compile_ok; then
  10351.         ./signal$_exe > signal.nsg
  10352.         $cat signal.nsg
  10353.     else
  10354.         echo "I can't seem to figure out how many signals you have." >&4
  10355.         echo "Guessing 50." >&4
  10356.         echo 'NSIG 50' > signal.nsg
  10357.     fi
  10358.     : Now look at all the signal names, one at a time.
  10359.     for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
  10360.         $cat > signal.c <<EOCP
  10361. #include <sys/types.h>
  10362. #include <signal.h>
  10363. #include <stdio.h>
  10364. int main() {
  10365. printf("$xx %d\n", SIG${xx});
  10366. return 0;
  10367. }
  10368. EOCP
  10369.         set signal
  10370.         if eval $compile; then
  10371.             echo "SIG${xx} found."
  10372.             ./signal$_exe  >> signal.ls1
  10373.         else
  10374.             echo "SIG${xx} NOT found."
  10375.         fi
  10376.     done
  10377.     if $test -s signal.ls1; then
  10378.         $cat signal.nsg signal.ls1 |
  10379.             $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
  10380.     fi
  10381.  
  10382. fi
  10383. if $test -s signal.lst; then
  10384.     :
  10385. else
  10386.     echo "(AAK! I can't compile the test programs -- Guessing)" >&4
  10387.     echo 'kill -l' >signal
  10388.     set X `csh -f <signal`
  10389.     $rm -f signal
  10390.     shift
  10391.     case $# in
  10392.     0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
  10393.     esac
  10394.     echo $@ | $tr ' ' $trnl | \
  10395.         $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
  10396. fi
  10397. $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
  10398. EOS
  10399. chmod a+x signal_cmd
  10400. $eunicefix signal_cmd
  10401.  
  10402. : generate list of signal names
  10403. echo " "
  10404. case "$sig_name_init" in
  10405. '')
  10406.     echo "Generating a list of signal names and numbers..." >&4
  10407.     . ./signal_cmd
  10408.     sig_name=`$awk '{printf "%s ", $1}' signal.lst`
  10409.     sig_name="ZERO $sig_name"
  10410.     sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
  10411.                         { printf "\"%s\", ", $1 }
  10412.                         END { printf "0\n" }' signal.lst`
  10413.     sig_num=`$awk 'BEGIN { printf "0, " }
  10414.                     { printf "%d, ", $2}
  10415.                     END { printf "0\n"}' signal.lst`
  10416.     ;;
  10417. esac
  10418. echo "The following signals are available:"
  10419. echo " "
  10420. echo $sig_name | $awk \
  10421. 'BEGIN { linelen = 0 }
  10422. {
  10423.     for (i = 1; i <= NF; i++) {
  10424.         name = "SIG" $i " "
  10425.         linelen = linelen + length(name)
  10426.         if (linelen > 70) {
  10427.             printf "\n"
  10428.             linelen = length(name)
  10429.         }
  10430.         printf "%s", name
  10431.     }
  10432.     printf "\n"
  10433. }'
  10434. $rm -f signal signal.c signal.awk signal.lst signal_cmd 
  10435.  
  10436. : see what type is used for signed size_t
  10437. set ssize_t ssizetype int stdio.h sys/types.h
  10438. eval $typedef
  10439. dflt="$ssizetype"
  10440. $cat > ssize.c <<EOM
  10441. #include <stdio.h>
  10442. #include <sys/types.h>
  10443. #define Size_t $sizetype
  10444. #define SSize_t $dflt
  10445. main()
  10446. {
  10447.     if (sizeof(Size_t) == sizeof(SSize_t))
  10448.         printf("$dflt\n");
  10449.     else if (sizeof(Size_t) == sizeof(int))
  10450.         printf("int\n");
  10451.     else 
  10452.         printf("long\n");
  10453.     exit(0);
  10454. }
  10455. EOM
  10456. echo " "
  10457. set ssize
  10458. if eval $compile_ok && ./ssize > /dev/null; then
  10459.     ssizetype=`./ssize`
  10460.     echo "I'll be using $ssizetype for functions returning a byte count." >&4
  10461. else
  10462.     $cat >&4 <<EOM
  10463. Help! I can't compile and run the ssize_t test program: please enlighten me!
  10464. (This is probably a misconfiguration in your system or libraries, and
  10465. you really ought to fix it.  Still, I'll try anyway.)
  10466.  
  10467. I need a type that is the same size as $sizetype, but is guaranteed to
  10468. be signed.  Common values are ssize_t, int and long.
  10469.  
  10470. EOM
  10471.     rp="What signed type is the same size as $sizetype?"
  10472.     . ./myread
  10473.     ssizetype="$ans"
  10474. fi
  10475. $rm -f ssize ssize.*
  10476.  
  10477. : see what type of char stdio uses.
  10478. echo " "
  10479. if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
  10480.     echo "Your stdio uses unsigned chars." >&4
  10481.     stdchar="unsigned char"
  10482. else
  10483.     echo "Your stdio uses signed chars." >&4
  10484.     stdchar="char"
  10485. fi
  10486.  
  10487. : see if time exists
  10488. echo " "
  10489. if test "X$d_time" = X -o X"$timetype" = X; then
  10490.     if set time val -f d_time; eval $csym; $val; then
  10491.     echo 'time() found.' >&4
  10492.     val="$define"
  10493.     rp="What is the type returned by time() on this system?"
  10494.     set time_t timetype long stdio.h sys/types.h
  10495.     eval $typedef_ask
  10496.     else
  10497.     echo 'time() not found, hope that will do.' >&4
  10498.     val="$undef"
  10499.     timetype='int';
  10500.     fi
  10501.     set d_time
  10502.     eval $setvar
  10503. fi
  10504.  
  10505. : see what type uids are declared as in the kernel
  10506. echo " "
  10507. echo "Looking for the type for user ids returned by getuid()."
  10508. set uid_t uidtype xxx stdio.h sys/types.h
  10509. eval $typedef
  10510. case "$uidtype" in
  10511. xxx)
  10512.     xxx=`./findhdr sys/user.h`
  10513.     set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
  10514.     case $1 in
  10515.     unsigned) dflt="$1 $2" ;;
  10516.     *) dflt="$1" ;;
  10517.     esac
  10518.     ;;
  10519. *) dflt="$uidtype";;
  10520. esac
  10521. case "$uidtype" in
  10522. uid_t)    echo "uid_t found." ;;
  10523. *)    rp="What is the type for user ids returned by getuid()?"
  10524.     . ./myread
  10525.     uidtype="$ans"
  10526.     ;;
  10527. esac
  10528.  
  10529. : see if dbm.h is available
  10530. : see if dbmclose exists
  10531. set dbmclose d_dbmclose
  10532. eval $inlibc
  10533.  
  10534. case "$d_dbmclose" in
  10535. $define)
  10536.     set dbm.h i_dbm
  10537.     eval $inhdr
  10538.     case "$i_dbm" in
  10539.     $define)
  10540.         val="$undef"
  10541.         set i_rpcsvcdbm
  10542.         eval $setvar
  10543.         ;;
  10544.     *)    set rpcsvc/dbm.h i_rpcsvcdbm
  10545.         eval $inhdr
  10546.         ;;
  10547.     esac
  10548.     ;;
  10549. *)    echo "We won't be including <dbm.h>"
  10550.     val="$undef"
  10551.     set i_dbm
  10552.     eval $setvar
  10553.     val="$undef"
  10554.     set i_rpcsvcdbm
  10555.     eval $setvar
  10556.     ;;
  10557. esac
  10558.  
  10559. : see if this is a sys/file.h system
  10560. val=''
  10561. set sys/file.h val
  10562. eval $inhdr
  10563.  
  10564. : do we need to include sys/file.h ?
  10565. case "$val" in
  10566. "$define")
  10567.     echo " "
  10568.     if $h_sysfile; then
  10569.         val="$define"
  10570.         echo "We'll be including <sys/file.h>." >&4
  10571.     else
  10572.         val="$undef"
  10573.         echo "We won't be including <sys/file.h>." >&4
  10574.     fi
  10575.     ;;
  10576. *)
  10577.     h_sysfile=false
  10578.     ;;
  10579. esac
  10580. set i_sysfile
  10581. eval $setvar
  10582.  
  10583. : see if fcntl.h is there
  10584. val=''
  10585. set fcntl.h val
  10586. eval $inhdr
  10587.  
  10588. : see if we can include fcntl.h
  10589. case "$val" in
  10590. "$define")
  10591.     echo " "
  10592.     if $h_fcntl; then
  10593.         val="$define"
  10594.         echo "We'll be including <fcntl.h>." >&4
  10595.     else
  10596.         val="$undef"
  10597.         if $h_sysfile; then
  10598.     echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
  10599.         else
  10600.             echo "We won't be including <fcntl.h>." >&4
  10601.         fi
  10602.     fi
  10603.     ;;
  10604. *)
  10605.     h_fcntl=false
  10606.     val="$undef"
  10607.     ;;
  10608. esac
  10609. set i_fcntl
  10610. eval $setvar
  10611.  
  10612. : see if this is an grp system
  10613. set grp.h i_grp
  10614. eval $inhdr
  10615.  
  10616. case "$i_grp" in
  10617. $define)
  10618.     : see if setgrent exists
  10619.     set setgrent d_setgrent
  10620.     eval $inlibc
  10621.  
  10622.     : see if getgrent exists
  10623.     set getgrent d_getgrent
  10624.     eval $inlibc
  10625.  
  10626.     : see if endgrent exists
  10627.     set endgrent d_endgrent
  10628.     eval $inlibc
  10629.  
  10630.     xxx=`./findhdr grp.h`
  10631.     $cppstdin $cppflags $cppminus < $xxx >$$.h
  10632.  
  10633.     if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
  10634.         val="$define"
  10635.     else
  10636.         val="$undef"
  10637.     fi
  10638.     set d_grpasswd
  10639.     eval $setvar
  10640.  
  10641.     $rm -f $$.h
  10642.     ;;
  10643. *)    # Assume all is lost as far as the d_*gr* go.
  10644.     val="$undef"; 
  10645.     set d_setgrent; eval $setvar
  10646.     set d_getgrent; eval $setvar
  10647.     set d_endgrent; eval $setvar
  10648.     set d_grpasswd; eval $setvar
  10649.     ;;
  10650. esac
  10651.  
  10652. : see if locale.h is available
  10653. set locale.h i_locale
  10654. eval $inhdr
  10655.  
  10656. : see if this is a math.h system
  10657. set math.h i_math
  10658. eval $inhdr
  10659.  
  10660. : see if ndbm.h is available
  10661. set ndbm.h t_ndbm
  10662. eval $inhdr
  10663. case "$t_ndbm" in
  10664. $define)
  10665.     : see if dbm_open exists
  10666.     set dbm_open d_dbm_open
  10667.     eval $inlibc
  10668.     case "$d_dbm_open" in
  10669.     $undef)
  10670.         t_ndbm="$undef"
  10671.         echo "We won't be including <ndbm.h>"
  10672.         ;;
  10673.     esac
  10674.     ;;
  10675. esac
  10676. val="$t_ndbm"
  10677. set i_ndbm
  10678. eval $setvar
  10679.  
  10680. : see if net/errno.h is available
  10681. val=''
  10682. set net/errno.h val
  10683. eval $inhdr
  10684.  
  10685. : Unfortunately, it causes problems on some systems.  Arrgh.
  10686. case "$val" in
  10687. $define)
  10688.     cat > try.c <<'EOM'
  10689. #include <stdio.h>
  10690. #include <errno.h>
  10691. #include <net/errno.h>
  10692. int func()
  10693. {
  10694.     return ENOTSOCK;
  10695. }
  10696. EOM
  10697.     if $cc $ccflags -c try.c >/dev/null 2>&1; then
  10698.         echo "We'll be including <net/errno.h>." >&4
  10699.     else
  10700.         echo "We won't be including <net/errno.h>." >&4
  10701.         val="$undef"
  10702.     fi
  10703.     $rm -f try.* try
  10704.     ;;
  10705. esac
  10706. set i_neterrno
  10707. eval $setvar
  10708.  
  10709. : get C preprocessor symbols handy
  10710. echo " "
  10711. $echo $n "Hmm... $c"
  10712. echo $al | $tr ' ' $trnl >Cppsym.know
  10713. $cat <<EOSS >Cppsym
  10714. $startsh
  10715. case "\$1" in
  10716. -l) list=true
  10717.     shift
  10718.     ;;
  10719. esac
  10720. unknown=''
  10721. case "\$list\$#" in
  10722. 1|2)
  10723.     for sym do
  10724.         if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
  10725.             exit 0
  10726.         elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
  10727.             :
  10728.         else
  10729.             unknown="\$unknown \$sym"
  10730.         fi
  10731.     done
  10732.     set X \$unknown
  10733.     shift
  10734.     ;;
  10735. esac
  10736. case \$# in
  10737. 0) exit 1;;
  10738. esac
  10739. echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
  10740. #ifdef \1\\
  10741. exit 0; _ _ _ _\1\\     \1\\
  10742. #endif\\
  10743. /' >Cppsym\$\$
  10744. echo "exit 1; _ _ _" >>Cppsym\$\$
  10745. $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
  10746. case "\$list" in
  10747. true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
  10748. *)
  10749.     sh Cppsym2\$\$
  10750.     status=\$?
  10751.     ;;
  10752. esac
  10753. $rm -f Cppsym\$\$ Cppsym2\$\$
  10754. exit \$status
  10755. EOSS
  10756. chmod +x Cppsym
  10757. $eunicefix Cppsym
  10758. ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
  10759.  
  10760. : now check the C compiler for additional symbols
  10761. $cat >ccsym <<EOS
  10762. $startsh
  10763. $cat >tmp.c <<EOF
  10764. extern int foo;
  10765. EOF
  10766. for i in \`$cc -v -c tmp.c 2>&1\`
  10767. do
  10768.     case "\$i" in
  10769.     -D*) echo "\$i" | $sed 's/^-D//';;
  10770.     -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
  10771.     esac
  10772. done
  10773. $rm -f try.c
  10774. EOS
  10775. chmod +x ccsym
  10776. $eunicefix ccsym
  10777. ./ccsym | $sort | $uniq >ccsym.raw
  10778. $awk '/\=/ { print $0; next }
  10779.     { print $0"=1" }' ccsym.raw >ccsym.list
  10780. $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
  10781. $comm -13 ccsym.true ccsym.list >ccsym.own
  10782. $comm -12 ccsym.true ccsym.list >ccsym.com
  10783. $comm -23 ccsym.true ccsym.list >ccsym.cpp
  10784. also=''
  10785. symbols='symbols'
  10786. if $test -z ccsym.raw; then
  10787.     echo "Your C compiler doesn't seem to define any symbol!" >&4
  10788.     echo " "
  10789.     echo "However, your C preprocessor defines the following ones:"
  10790.     $cat Cppsym.true
  10791. else
  10792.     if $test -s ccsym.com; then
  10793.         echo "Your C compiler and pre-processor define these symbols:"
  10794.         $sed -e 's/\(.*\)=.*/\1/' ccsym.com
  10795.         also='also '
  10796.         symbols='ones'
  10797.         $test "$silent" || sleep 1
  10798.     fi
  10799.     if $test -s ccsym.cpp; then
  10800.         $test "$also" && echo " "
  10801.         echo "Your C pre-processor ${also}defines the following $symbols:"
  10802.         $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
  10803.         also='further '
  10804.         $test "$silent" || sleep 1
  10805.     fi
  10806.     if $test -s ccsym.own; then
  10807.         $test "$also" && echo " "
  10808.         echo "Your C compiler ${also}defines the following cpp variables:"
  10809.         $sed -e 's/\(.*\)=1/\1/' ccsym.own
  10810.         $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
  10811.         $test "$silent" || sleep 1
  10812.     fi
  10813. fi
  10814. $rm -f ccsym*
  10815.  
  10816. : see if this is a termio system
  10817. val="$undef"
  10818. val2="$undef"
  10819. val3="$undef"
  10820. if $test `./findhdr termios.h`; then
  10821.     set tcsetattr i_termios
  10822.     eval $inlibc
  10823.     val3="$i_termios"
  10824. fi
  10825. echo " "
  10826. case "$val3" in
  10827. "$define") echo "You have POSIX termios.h... good!" >&4;;
  10828. *) if ./Cppsym pyr; then
  10829.         case "`/bin/universe`" in
  10830.         ucb) if $test `./findhdr sgtty.h`; then
  10831.                 val2="$define"
  10832.                 echo "<sgtty.h> found." >&4
  10833.             else
  10834.                 echo "System is pyramid with BSD universe."
  10835.                 echo "<sgtty.h> not found--you could have problems." >&4
  10836.             fi;;
  10837.         *) if $test `./findhdr termio.h`; then
  10838.                 val="$define"
  10839.                 echo "<termio.h> found." >&4
  10840.             else
  10841.                 echo "System is pyramid with USG universe."
  10842.                 echo "<termio.h> not found--you could have problems." >&4
  10843.             fi;;
  10844.         esac
  10845.     elif ./usg; then
  10846.         if $test `./findhdr termio.h`; then
  10847.             echo "<termio.h> found." >&4
  10848.             val="$define"
  10849.         elif $test `./findhdr sgtty.h`; then
  10850.             echo "<sgtty.h> found." >&4
  10851.             val2="$define"
  10852.         else
  10853. echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
  10854.         fi
  10855.     else
  10856.         if $test `./findhdr sgtty.h`; then
  10857.             echo "<sgtty.h> found." >&4
  10858.             val2="$define"
  10859.         elif $test `./findhdr termio.h`; then
  10860.             echo "<termio.h> found." >&4
  10861.             val="$define"
  10862.         else
  10863. echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
  10864.         fi
  10865.     fi;;
  10866. esac
  10867. set i_termio; eval $setvar
  10868. val=$val2; set i_sgtty; eval $setvar
  10869. val=$val3; set i_termios; eval $setvar
  10870.  
  10871. : see if stdarg is available
  10872. echo " "
  10873. if $test `./findhdr stdarg.h`; then
  10874.     echo "<stdarg.h> found." >&4
  10875.     valstd="$define"
  10876. else
  10877.     echo "<stdarg.h> NOT found." >&4
  10878.     valstd="$undef"
  10879. fi
  10880.  
  10881. : see if varags is available
  10882. echo " "
  10883. if $test `./findhdr varargs.h`; then
  10884.     echo "<varargs.h> found." >&4
  10885. else
  10886.     echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
  10887. fi
  10888.  
  10889. : set up the varargs testing programs
  10890. $cat > varargs.c <<EOP
  10891. #ifdef I_STDARG
  10892. #include <stdarg.h>
  10893. #endif
  10894. #ifdef I_VARARGS
  10895. #include <varargs.h>
  10896. #endif
  10897.  
  10898. #ifdef I_STDARG
  10899. int f(char *p, ...)
  10900. #else
  10901. int f(va_alist)
  10902. va_dcl
  10903. #endif
  10904. {
  10905.     va_list ap;
  10906. #ifndef I_STDARG
  10907.     char *p;
  10908. #endif
  10909. #ifdef I_STDARG
  10910.     va_start(ap,p);
  10911. #else
  10912.     va_start(ap);
  10913.     p = va_arg(ap, char *);
  10914. #endif
  10915.     va_end(ap);
  10916. }
  10917. EOP
  10918. $cat > varargs <<EOP
  10919. $startsh
  10920. if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
  10921.     echo "true"
  10922. else
  10923.     echo "false"
  10924. fi
  10925. $rm -f varargs$_o
  10926. EOP
  10927. chmod +x varargs
  10928.  
  10929. : now check which varargs header should be included
  10930. echo " "
  10931. i_varhdr=''
  10932. case "$valstd" in
  10933. "$define")
  10934.     if `./varargs I_STDARG`; then
  10935.         val='stdarg.h'
  10936.     elif `./varargs I_VARARGS`; then
  10937.         val='varargs.h'
  10938.     fi
  10939.     ;;
  10940. *)
  10941.     if `./varargs I_VARARGS`; then
  10942.         val='varargs.h'
  10943.     fi
  10944.     ;;
  10945. esac
  10946. case "$val" in
  10947. '')
  10948. echo "I could not find the definition for va_dcl... You have problems..." >&4
  10949.     val="$undef"; set i_stdarg; eval $setvar
  10950.     val="$undef"; set i_varargs; eval $setvar
  10951.     ;;
  10952. *) 
  10953.     set i_varhdr
  10954.     eval $setvar
  10955.     case "$i_varhdr" in
  10956.     stdarg.h)
  10957.         val="$define"; set i_stdarg; eval $setvar
  10958.         val="$undef"; set i_varargs; eval $setvar
  10959.         ;;
  10960.     varargs.h)
  10961.         val="$undef"; set i_stdarg; eval $setvar
  10962.         val="$define"; set i_varargs; eval $setvar
  10963.         ;;
  10964.     esac
  10965.     echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
  10966. esac
  10967. $rm -f varargs*
  10968.  
  10969. : see if stddef is available
  10970. set stddef.h i_stddef
  10971. eval $inhdr
  10972.  
  10973. : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
  10974. set sys/filio.h i_sysfilio
  10975. eval $inhdr
  10976. echo " "
  10977. if $test `./findhdr sys/ioctl.h`; then
  10978.     val="$define"
  10979.     echo '<sys/ioctl.h> found.' >&4
  10980. else
  10981.     val="$undef"
  10982.     if $test $i_sysfilio = "$define"; then
  10983.         echo '<sys/ioctl.h> NOT found.' >&4
  10984.     else
  10985.         $test $i_sgtty = "$define" && xxx="sgtty.h"
  10986.         $test $i_termio = "$define" && xxx="termio.h"
  10987.         $test $i_termios = "$define" && xxx="termios.h"
  10988. echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
  10989.     fi
  10990. fi
  10991. set i_sysioctl
  10992. eval $setvar
  10993.  
  10994. : see if this is a sys/param system
  10995. set sys/param.h i_sysparam
  10996. eval $inhdr
  10997.  
  10998. : see if sys/resource.h has to be included
  10999. set sys/resource.h i_sysresrc
  11000. eval $inhdr
  11001.  
  11002. : see if sys/stat.h is available
  11003. set sys/stat.h i_sysstat
  11004. eval $inhdr
  11005.  
  11006. : see if this is a sys/un.h system
  11007. set sys/un.h i_sysun
  11008. eval $inhdr
  11009.  
  11010. : see if this is a syswait system
  11011. set sys/wait.h i_syswait
  11012. eval $inhdr
  11013.  
  11014. : see if this is an utime system
  11015. set utime.h i_utime
  11016. eval $inhdr
  11017.  
  11018. : see if this is a values.h system
  11019. set values.h i_values
  11020. eval $inhdr
  11021.  
  11022. : see if this is a vfork system
  11023. case "$d_vfork" in
  11024. "$define")
  11025.     set vfork.h i_vfork
  11026.     eval $inhdr
  11027.     ;;
  11028. *)
  11029.     i_vfork="$undef"
  11030.     ;;
  11031. esac
  11032.  
  11033. : see if gdbm.h is available
  11034. set gdbm.h t_gdbm
  11035. eval $inhdr
  11036. case "$t_gdbm" in
  11037. $define)
  11038.     : see if gdbm_open exists
  11039.     set gdbm_open d_gdbm_open
  11040.     eval $inlibc
  11041.     case "$d_gdbm_open" in
  11042.     $undef)
  11043.         t_gdbm="$undef"
  11044.         echo "We won't be including <gdbm.h>"
  11045.         ;;
  11046.     esac
  11047.     ;;
  11048. esac
  11049. val="$t_gdbm"
  11050. set i_gdbm
  11051. eval $setvar
  11052.  
  11053. echo " "
  11054. echo "Looking for extensions..." >&4
  11055. tdir=`pwd`
  11056. cd $rsrc/ext
  11057. : If we are using the old config.sh, known_extensions may contain
  11058. : old or inaccurate or duplicate values.
  11059. known_extensions=''
  11060. nonxs_extensions=''
  11061. : We do not use find because it might not be available.
  11062. : We do not just use MANIFEST because the user may have dropped
  11063. : some additional extensions into the source tree and expect them
  11064. : to be built.
  11065. for xxx in * ; do
  11066.     case "$xxx" in
  11067.     DynaLoader|dynaload) ;;
  11068.     *)    if $test -f $xxx/$xxx.xs; then
  11069.             known_extensions="$known_extensions $xxx"
  11070.         elif $test -f $xxx/Makefile.PL; then
  11071.             nonxs_extensions="$nonxs_extensions $xxx"
  11072.         else
  11073.             if $test -d $xxx; then
  11074.                 # Look for nested extensions, eg. Devel/Dprof.
  11075.                 cd $xxx
  11076.                 for yyy in * ; do
  11077.                 if $test -f $yyy/$yyy.xs; then
  11078.                     known_extensions="$known_extensions $xxx/$yyy"
  11079.                 elif $test -f $yyy/Makefile.PL; then
  11080.                     nonxs_extensions="$nonxs_extensions $xxx/$yyy"
  11081.                 fi
  11082.                 done
  11083.                 cd ..
  11084.             fi
  11085.         fi 
  11086.         ;;
  11087.     esac
  11088. done
  11089. set X $nonxs_extensions
  11090. shift
  11091. nonxs_extensions="$*"
  11092. set X $known_extensions
  11093. shift
  11094. known_extensions="$*"
  11095. cd $tdir
  11096.  
  11097. : Now see which are supported on this system.
  11098. avail_ext=''
  11099. for xxx in $known_extensions ; do
  11100.     case "$xxx" in
  11101.     DB_File|db_file)
  11102.         case "$i_db" in
  11103.         $define) avail_ext="$avail_ext $xxx" ;;
  11104.         esac
  11105.         ;;
  11106.     GDBM_File|gdbm_fil)
  11107.         case "$i_gdbm" in 
  11108.         $define) avail_ext="$avail_ext $xxx" ;;
  11109.         esac
  11110.         ;;
  11111.     NDBM_File|ndbm_fil)
  11112.         case "$i_ndbm" in
  11113.         $define) avail_ext="$avail_ext $xxx" ;;
  11114.         esac
  11115.         ;;
  11116.     ODBM_File|odbm_fil) 
  11117.         case "${i_dbm}${i_rpcsvcdbm}" in
  11118.         *"${define}"*) avail_ext="$avail_ext $xxx" ;;
  11119.         esac
  11120.         ;;
  11121.     POSIX|posix)
  11122.         case "$useposix" in
  11123.         true|define|y) avail_ext="$avail_ext $xxx" ;;
  11124.         esac
  11125.         ;;
  11126.     Opcode|opcode)
  11127.         case "$useopcode" in
  11128.         true|define|y) avail_ext="$avail_ext $xxx" ;;
  11129.         esac
  11130.         ;;
  11131.     Socket|socket)
  11132.         case "$d_socket" in 
  11133.         true|$define|y) avail_ext="$avail_ext $xxx" ;;
  11134.         esac
  11135.         ;;
  11136.     Thread|thread)
  11137.         case "$usethreads" in 
  11138.         true|$define|y) avail_ext="$avail_ext $xxx" ;;
  11139.         esac
  11140.         ;;
  11141.     IPC/SysV|ipc/sysv)
  11142.         case "${d_msg}${d_sem}${d_shm}" in 
  11143.         *"${define}"*) avail_ext="$avail_ext $xxx" ;;
  11144.         esac
  11145.         ;;
  11146.     *)    avail_ext="$avail_ext $xxx"
  11147.         ;;
  11148.     esac
  11149. done
  11150.  
  11151. set X $avail_ext
  11152. shift
  11153. avail_ext="$*"
  11154.  
  11155. : Now see which nonxs extensions are supported on this system.
  11156. : For now assume all are.
  11157. nonxs_ext=''
  11158. for xxx in $nonxs_extensions ; do
  11159.     case "$xxx" in
  11160.     *)    nonxs_ext="$nonxs_ext $xxx"
  11161.         ;;
  11162.     esac
  11163. done
  11164.  
  11165. set X $nonxs_ext
  11166. shift
  11167. nonxs_ext="$*"
  11168.  
  11169. case $usedl in
  11170. $define)
  11171.     $cat <<EOM
  11172. A number of extensions are supplied with $package.  You may choose to
  11173. compile these extensions for dynamic loading (the default), compile
  11174. them into the $package executable (static loading), or not include
  11175. them at all.  Answer "none" to include no extensions.
  11176. Note that DynaLoader is always built and need not be mentioned here.
  11177.  
  11178. EOM
  11179.     case "$dynamic_ext" in
  11180.     '') dflt="$avail_ext" ;;
  11181.     *)    dflt="$dynamic_ext"
  11182.         # Perhaps we are reusing an old out-of-date config.sh.
  11183.         case "$hint" in
  11184.         previous)
  11185.             if test X"$dynamic_ext" != X"$avail_ext"; then
  11186.                 $cat <<EOM
  11187. NOTICE:  Your previous config.sh list may be incorrect. 
  11188. The extensions now available to you are 
  11189.     ${avail_ext}
  11190. but the default list from your previous config.sh is
  11191.     ${dynamic_ext} 
  11192.  
  11193. EOM
  11194.             fi
  11195.             ;;
  11196.         esac
  11197.         ;;
  11198.     esac
  11199.     case "$dflt" in
  11200.     '')    dflt=none;;
  11201.     esac
  11202.     rp="What extensions do you wish to load dynamically?"
  11203.     . ./myread
  11204.     case "$ans" in
  11205.     none) dynamic_ext=' ' ;;
  11206.     *) dynamic_ext="$ans" ;;
  11207.     esac
  11208.  
  11209.     case "$static_ext" in
  11210.     '')
  11211.         : Exclude those already listed in dynamic linking
  11212.         dflt=''
  11213.         for xxx in $avail_ext; do
  11214.             case " $dynamic_ext " in
  11215.             *" $xxx "*) ;;
  11216.             *) dflt="$dflt $xxx" ;;
  11217.             esac
  11218.         done
  11219.         set X $dflt
  11220.         shift
  11221.         dflt="$*"
  11222.         ;;
  11223.     *)  dflt="$static_ext" 
  11224.         ;;
  11225.     esac
  11226.  
  11227.     case "$dflt" in
  11228.     '')    dflt=none;;
  11229.     esac
  11230.     rp="What extensions do you wish to load statically?"
  11231.     . ./myread
  11232.     case "$ans" in
  11233.     none) static_ext=' ' ;;
  11234.     *) static_ext="$ans" ;;
  11235.     esac
  11236.     ;;
  11237. *)
  11238.     $cat <<EOM
  11239. A number of extensions are supplied with $package.  Answer "none" 
  11240. to include no extensions. 
  11241. Note that DynaLoader is always built and need not be mentioned here.
  11242.  
  11243. EOM
  11244.     case "$static_ext" in
  11245.     '') dflt="$avail_ext" ;;
  11246.     *)    dflt="$static_ext"
  11247.         # Perhaps we are reusing an old out-of-date config.sh.
  11248.         case "$hint" in
  11249.         previous)
  11250.             if test X"$static_ext" != X"$avail_ext"; then
  11251.                 $cat <<EOM
  11252. NOTICE:  Your previous config.sh list may be incorrect. 
  11253. The extensions now available to you are 
  11254.     ${avail_ext}
  11255. but the default list from your previous config.sh is
  11256.     ${static_ext} 
  11257.  
  11258. EOM
  11259.             fi
  11260.             ;;
  11261.         esac
  11262.         ;;
  11263.     esac
  11264.     : Exclude those that are not xs extensions
  11265.     case "$dflt" in
  11266.     '')    dflt=none;;
  11267.     esac
  11268.     rp="What extensions do you wish to include?"
  11269.     . ./myread
  11270.     case "$ans" in
  11271.     none) static_ext=' ' ;;
  11272.     *) static_ext="$ans" ;;
  11273.     esac
  11274.     ;;
  11275. esac
  11276.  
  11277. set X $dynamic_ext $static_ext $nonxs_ext
  11278. shift
  11279. extensions="$*"
  11280.  
  11281. : Remove build directory name from cppstdin so it can be used from
  11282. : either the present location or the final installed location.
  11283. echo " "
  11284. : Get out of the UU directory to get correct path name.
  11285. cd ..
  11286. case "$cppstdin" in
  11287. `pwd`/cppstdin)
  11288.     echo "Stripping down cppstdin path name"
  11289.     cppstdin=cppstdin
  11290.     ;;
  11291. esac
  11292. cd UU
  11293.  
  11294. : end of configuration questions
  11295. echo " "
  11296. echo "End of configuration questions."
  11297. echo " "
  11298.  
  11299. : back to where it started
  11300. if test -d ../UU; then
  11301.     cd ..
  11302. fi
  11303.  
  11304. : configuration may be patched via a 'config.over' file
  11305. if $test -f config.over; then
  11306.     echo " "
  11307.     dflt=y
  11308.     rp='I see a config.over file.  Do you wish to load it?'
  11309.     . UU/myread
  11310.     case "$ans" in
  11311.     n*) echo "OK, I'll ignore it.";;
  11312.     *)    . ./config.over
  11313.         echo "Configuration override changes have been loaded."
  11314.         ;;
  11315.     esac
  11316. fi
  11317.  
  11318. : in case they want portability, strip down executable paths
  11319. case "$d_portable" in
  11320. "$define")
  11321.     echo " "
  11322.     echo "Stripping down executable paths..." >&4
  11323.     for file in $loclist $trylist; do
  11324.         if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
  11325.             eval $file="\$file"
  11326.         fi
  11327.     done
  11328.     ;;
  11329. esac
  11330.  
  11331. : create config.sh file
  11332. echo " "
  11333. echo "Creating config.sh..." >&4
  11334. $spitshell <<EOT >config.sh
  11335. $startsh
  11336. #
  11337. # This file was produced by running the Configure script. It holds all the
  11338. # definitions figured out by Configure. Should you modify one of these values,
  11339. # do not forget to propagate your changes by running "Configure -der". You may
  11340. # instead choose to run each of the .SH files by yourself, or "Configure -S".
  11341. #
  11342.  
  11343. # Package name      : $package
  11344. # Source directory  : $src
  11345. # Configuration time: $cf_time
  11346. # Configured by     : $cf_by
  11347. # Target system     : $myuname
  11348.  
  11349. Author='$Author'
  11350. Date='$Date'
  11351. Header='$Header'
  11352. Id='$Id'
  11353. Locker='$Locker'
  11354. Log='$Log'
  11355. Mcc='$Mcc'
  11356. RCSfile='$RCSfile'
  11357. Revision='$Revision'
  11358. Source='$Source'
  11359. State='$State'
  11360. _a='$_a'
  11361. _exe='$_exe'
  11362. _o='$_o'
  11363. afs='$afs'
  11364. alignbytes='$alignbytes'
  11365. ansi2knr='$ansi2knr'
  11366. aphostname='$aphostname'
  11367. apiversion='$apiversion'
  11368. ar='$ar'
  11369. archlib='$archlib'
  11370. archlibexp='$archlibexp'
  11371. archname='$archname'
  11372. archobjs='$archobjs'
  11373. awk='$awk'
  11374. baserev='$baserev'
  11375. bash='$bash'
  11376. bin='$bin'
  11377. binexp='$binexp'
  11378. bison='$bison'
  11379. byacc='$byacc'
  11380. byteorder='$byteorder'
  11381. c='$c'
  11382. castflags='$castflags'
  11383. cat='$cat'
  11384. cc='$cc'
  11385. cccdlflags='$cccdlflags'
  11386. ccdlflags='$ccdlflags'
  11387. ccflags='$ccflags'
  11388. cf_by='$cf_by'
  11389. cf_email='$cf_email'
  11390. cf_time='$cf_time'
  11391. chgrp='$chgrp'
  11392. chmod='$chmod'
  11393. chown='$chown'
  11394. clocktype='$clocktype'
  11395. comm='$comm'
  11396. compress='$compress'
  11397. contains='$contains'
  11398. cp='$cp'
  11399. cpio='$cpio'
  11400. cpp='$cpp'
  11401. cpp_stuff='$cpp_stuff'
  11402. cppflags='$cppflags'
  11403. cpplast='$cpplast'
  11404. cppminus='$cppminus'
  11405. cpprun='$cpprun'
  11406. cppstdin='$cppstdin'
  11407. cryptlib='$cryptlib'
  11408. csh='$csh'
  11409. d_Gconvert='$d_Gconvert'
  11410. d_access='$d_access'
  11411. d_alarm='$d_alarm'
  11412. d_archlib='$d_archlib'
  11413. d_attribut='$d_attribut'
  11414. d_bcmp='$d_bcmp'
  11415. d_bcopy='$d_bcopy'
  11416. d_bsd='$d_bsd'
  11417. d_bsdgetpgrp='$d_bsdgetpgrp'
  11418. d_bsdsetpgrp='$d_bsdsetpgrp'
  11419. d_bzero='$d_bzero'
  11420. d_casti32='$d_casti32'
  11421. d_castneg='$d_castneg'
  11422. d_charvspr='$d_charvspr'
  11423. d_chown='$d_chown'
  11424. d_chroot='$d_chroot'
  11425. d_chsize='$d_chsize'
  11426. d_closedir='$d_closedir'
  11427. d_const='$d_const'
  11428. d_crypt='$d_crypt'
  11429. d_csh='$d_csh'
  11430. d_cuserid='$d_cuserid'
  11431. d_dbl_dig='$d_dbl_dig'
  11432. d_difftime='$d_difftime'
  11433. d_dirnamlen='$d_dirnamlen'
  11434. d_dlerror='$d_dlerror'
  11435. d_dlopen='$d_dlopen'
  11436. d_dlsymun='$d_dlsymun'
  11437. d_dosuid='$d_dosuid'
  11438. d_dup2='$d_dup2'
  11439. d_endgrent='$d_endgrent'
  11440. d_endhent='$d_endhent'
  11441. d_endnent='$d_endnent'
  11442. d_endpent='$d_endpent'
  11443. d_endpwent='$d_endpwent'
  11444. d_endsent='$d_endsent'
  11445. d_eofnblk='$d_eofnblk'
  11446. d_eunice='$d_eunice'
  11447. d_fchmod='$d_fchmod'
  11448. d_fchown='$d_fchown'
  11449. d_fcntl='$d_fcntl'
  11450. d_fd_macros='$d_fd_macros'
  11451. d_fd_set='$d_fd_set'
  11452. d_fds_bits='$d_fds_bits'
  11453. d_fgetpos='$d_fgetpos'
  11454. d_flexfnam='$d_flexfnam'
  11455. d_flock='$d_flock'
  11456. d_fork='$d_fork'
  11457. d_fpathconf='$d_fpathconf'
  11458. d_fsetpos='$d_fsetpos'
  11459. d_ftime='$d_ftime'
  11460. d_getgrent='$d_getgrent'
  11461. d_getgrps='$d_getgrps'
  11462. d_gethbyaddr='$d_gethbyaddr'
  11463. d_gethbyname='$d_gethbyname'
  11464. d_gethent='$d_gethent'
  11465. d_gethname='$d_gethname'
  11466. d_gethostprotos='$d_gethostprotos'
  11467. d_getlogin='$d_getlogin'
  11468. d_getnbyaddr='$d_getnbyaddr'
  11469. d_getnbyname='$d_getnbyname'
  11470. d_getnent='$d_getnent'
  11471. d_getnetprotos='$d_getnetprotos'
  11472. d_getpbyname='$d_getpbyname'
  11473. d_getpbynumber='$d_getpbynumber'
  11474. d_getpent='$d_getpent'
  11475. d_getpgid='$d_getpgid'
  11476. d_getpgrp2='$d_getpgrp2'
  11477. d_getpgrp='$d_getpgrp'
  11478. d_getppid='$d_getppid'
  11479. d_getprior='$d_getprior'
  11480. d_getprotoprotos='$d_getprotoprotos'
  11481. d_getpwent='$d_getpwent'
  11482. d_getsbyname='$d_getsbyname'
  11483. d_getsbyport='$d_getsbyport'
  11484. d_getsent='$d_getsent'
  11485. d_getservprotos='$d_getservprotos'
  11486. d_gettimeod='$d_gettimeod'
  11487. d_gnulibc='$d_gnulibc'
  11488. d_grpasswd='$d_grpasswd'
  11489. d_htonl='$d_htonl'
  11490. d_index='$d_index'
  11491. d_inetaton='$d_inetaton'
  11492. d_isascii='$d_isascii'
  11493. d_killpg='$d_killpg'
  11494. d_lchown='$d_lchown'
  11495. d_link='$d_link'
  11496. d_locconv='$d_locconv'
  11497. d_lockf='$d_lockf'
  11498. d_longdbl='$d_longdbl'
  11499. d_longlong='$d_longlong'
  11500. d_lstat='$d_lstat'
  11501. d_mblen='$d_mblen'
  11502. d_mbstowcs='$d_mbstowcs'
  11503. d_mbtowc='$d_mbtowc'
  11504. d_memcmp='$d_memcmp'
  11505. d_memcpy='$d_memcpy'
  11506. d_memmove='$d_memmove'
  11507. d_memset='$d_memset'
  11508. d_mkdir='$d_mkdir'
  11509. d_mkfifo='$d_mkfifo'
  11510. d_mktime='$d_mktime'
  11511. d_msg='$d_msg'
  11512. d_msgctl='$d_msgctl'
  11513. d_msgget='$d_msgget'
  11514. d_msgrcv='$d_msgrcv'
  11515. d_msgsnd='$d_msgsnd'
  11516. d_mymalloc='$d_mymalloc'
  11517. d_nice='$d_nice'
  11518. d_oldpthreads='$d_oldpthreads'
  11519. d_oldsock='$d_oldsock'
  11520. d_open3='$d_open3'
  11521. d_pathconf='$d_pathconf'
  11522. d_pause='$d_pause'
  11523. d_phostname='$d_phostname'
  11524. d_pipe='$d_pipe'
  11525. d_poll='$d_poll'
  11526. d_portable='$d_portable'
  11527. d_pthread_yield='$d_pthread_yield'
  11528. d_pthreads_created_joinable='$d_pthreads_created_joinable'
  11529. d_pwage='$d_pwage'
  11530. d_pwchange='$d_pwchange'
  11531. d_pwclass='$d_pwclass'
  11532. d_pwcomment='$d_pwcomment'
  11533. d_pwexpire='$d_pwexpire'
  11534. d_pwgecos='$d_pwgecos'
  11535. d_pwquota='$d_pwquota'
  11536. d_pwpasswd='$d_pwpasswd'
  11537. d_readdir='$d_readdir'
  11538. d_readlink='$d_readlink'
  11539. d_rename='$d_rename'
  11540. d_rewinddir='$d_rewinddir'
  11541. d_rmdir='$d_rmdir'
  11542. d_safebcpy='$d_safebcpy'
  11543. d_safemcpy='$d_safemcpy'
  11544. d_sanemcmp='$d_sanemcmp'
  11545. d_sched_yield='$d_sched_yield'
  11546. d_seekdir='$d_seekdir'
  11547. d_select='$d_select'
  11548. d_sem='$d_sem'
  11549. d_semctl='$d_semctl'
  11550. d_semctl_semid_ds='$d_semctl_semid_ds'
  11551. d_semctl_semun='$d_semctl_semun'
  11552. d_semget='$d_semget'
  11553. d_semop='$d_semop'
  11554. d_setegid='$d_setegid'
  11555. d_seteuid='$d_seteuid'
  11556. d_setgrent='$d_setgrent'
  11557. d_setgrps='$d_setgrps'
  11558. d_sethent='$d_sethent'
  11559. d_setlinebuf='$d_setlinebuf'
  11560. d_setlocale='$d_setlocale'
  11561. d_setnent='$d_setnent'
  11562. d_setpent='$d_setpent'
  11563. d_setpgid='$d_setpgid'
  11564. d_setpgrp2='$d_setpgrp2'
  11565. d_setpgrp='$d_setpgrp'
  11566. d_setprior='$d_setprior'
  11567. d_setpwent='$d_setpwent'
  11568. d_setregid='$d_setregid'
  11569. d_setresgid='$d_setresgid'
  11570. d_setresuid='$d_setresuid'
  11571. d_setreuid='$d_setreuid'
  11572. d_setrgid='$d_setrgid'
  11573. d_setruid='$d_setruid'
  11574. d_setsent='$d_setsent'
  11575. d_setsid='$d_setsid'
  11576. d_setvbuf='$d_setvbuf'
  11577. d_sfio='$d_sfio'
  11578. d_shm='$d_shm'
  11579. d_shmat='$d_shmat'
  11580. d_shmatprototype='$d_shmatprototype'
  11581. d_shmctl='$d_shmctl'
  11582. d_shmdt='$d_shmdt'
  11583. d_shmget='$d_shmget'
  11584. d_sigaction='$d_sigaction'
  11585. d_sigsetjmp='$d_sigsetjmp'
  11586. d_socket='$d_socket'
  11587. d_sockpair='$d_sockpair'
  11588. d_statblks='$d_statblks'
  11589. d_stdio_cnt_lval='$d_stdio_cnt_lval'
  11590. d_stdio_ptr_lval='$d_stdio_ptr_lval'
  11591. d_stdiobase='$d_stdiobase'
  11592. d_stdstdio='$d_stdstdio'
  11593. d_strchr='$d_strchr'
  11594. d_strcoll='$d_strcoll'
  11595. d_strctcpy='$d_strctcpy'
  11596. d_strerrm='$d_strerrm'
  11597. d_strerror='$d_strerror'
  11598. d_strtod='$d_strtod'
  11599. d_strtol='$d_strtol'
  11600. d_strtoul='$d_strtoul'
  11601. d_strxfrm='$d_strxfrm'
  11602. d_suidsafe='$d_suidsafe'
  11603. d_symlink='$d_symlink'
  11604. d_syscall='$d_syscall'
  11605. d_sysconf='$d_sysconf'
  11606. d_sysernlst='$d_sysernlst'
  11607. d_syserrlst='$d_syserrlst'
  11608. d_system='$d_system'
  11609. d_tcgetpgrp='$d_tcgetpgrp'
  11610. d_tcsetpgrp='$d_tcsetpgrp'
  11611. d_telldir='$d_telldir'
  11612. d_time='$d_time'
  11613. d_times='$d_times'
  11614. d_truncate='$d_truncate'
  11615. d_tzname='$d_tzname'
  11616. d_umask='$d_umask'
  11617. d_uname='$d_uname'
  11618. d_union_semun='$d_union_semun'
  11619. d_vfork='$d_vfork'
  11620. d_void_closedir='$d_void_closedir'
  11621. d_voidsig='$d_voidsig'
  11622. d_voidtty='$d_voidtty'
  11623. d_volatile='$d_volatile'
  11624. d_vprintf='$d_vprintf'
  11625. d_wait4='$d_wait4'
  11626. d_waitpid='$d_waitpid'
  11627. d_wcstombs='$d_wcstombs'
  11628. d_wctomb='$d_wctomb'
  11629. d_xenix='$d_xenix'
  11630. date='$date'
  11631. db_hashtype='$db_hashtype'
  11632. db_prefixtype='$db_prefixtype'
  11633. defvoidused='$defvoidused'
  11634. direntrytype='$direntrytype'
  11635. dlext='$dlext'
  11636. dlsrc='$dlsrc'
  11637. doublesize='$doublesize'
  11638. dynamic_ext='$dynamic_ext'
  11639. eagain='$eagain'
  11640. ebcdic='$ebcdic'
  11641. echo='$echo'
  11642. egrep='$egrep'
  11643. emacs='$emacs'
  11644. eunicefix='$eunicefix'
  11645. exe_ext='$exe_ext'
  11646. expr='$expr'
  11647. extensions='$extensions'
  11648. find='$find'
  11649. firstmakefile='$firstmakefile'
  11650. flex='$flex'
  11651. fpostype='$fpostype'
  11652. freetype='$freetype'
  11653. full_csh='$full_csh'
  11654. full_sed='$full_sed'
  11655. gccversion='$gccversion'
  11656. gidtype='$gidtype'
  11657. glibpth='$glibpth'
  11658. grep='$grep'
  11659. groupcat='$groupcat'
  11660. groupstype='$groupstype'
  11661. gzip='$gzip'
  11662. h_fcntl='$h_fcntl'
  11663. h_sysfile='$h_sysfile'
  11664. hint='$hint'
  11665. hostcat='$hostcat'
  11666. huge='$huge'
  11667. i_arpainet='$i_arpainet'
  11668. i_bsdioctl='$i_bsdioctl'
  11669. i_db='$i_db'
  11670. i_dbm='$i_dbm'
  11671. i_dirent='$i_dirent'
  11672. i_dld='$i_dld'
  11673. i_dlfcn='$i_dlfcn'
  11674. i_fcntl='$i_fcntl'
  11675. i_float='$i_float'
  11676. i_gdbm='$i_gdbm'
  11677. i_grp='$i_grp'
  11678. i_limits='$i_limits'
  11679. i_locale='$i_locale'
  11680. i_malloc='$i_malloc'
  11681. i_math='$i_math'
  11682. i_memory='$i_memory'
  11683. i_ndbm='$i_ndbm'
  11684. i_netdb='$i_netdb'
  11685. i_neterrno='$i_neterrno'
  11686. i_niin='$i_niin'
  11687. i_pwd='$i_pwd'
  11688. i_rpcsvcdbm='$i_rpcsvcdbm'
  11689. i_sfio='$i_sfio'
  11690. i_sgtty='$i_sgtty'
  11691. i_stdarg='$i_stdarg'
  11692. i_stddef='$i_stddef'
  11693. i_stdlib='$i_stdlib'
  11694. i_string='$i_string'
  11695. i_sysdir='$i_sysdir'
  11696. i_sysfile='$i_sysfile'
  11697. i_sysfilio='$i_sysfilio'
  11698. i_sysin='$i_sysin'
  11699. i_sysioctl='$i_sysioctl'
  11700. i_sysndir='$i_sysndir'
  11701. i_sysparam='$i_sysparam'
  11702. i_sysresrc='$i_sysresrc'
  11703. i_sysselct='$i_sysselct'
  11704. i_syssockio='$i_syssockio'
  11705. i_sysstat='$i_sysstat'
  11706. i_systime='$i_systime'
  11707. i_systimek='$i_systimek'
  11708. i_systimes='$i_systimes'
  11709. i_systypes='$i_systypes'
  11710. i_sysun='$i_sysun'
  11711. i_syswait='$i_syswait'
  11712. i_termio='$i_termio'
  11713. i_termios='$i_termios'
  11714. i_time='$i_time'
  11715. i_unistd='$i_unistd'
  11716. i_utime='$i_utime'
  11717. i_values='$i_values'
  11718. i_varargs='$i_varargs'
  11719. i_varhdr='$i_varhdr'
  11720. i_vfork='$i_vfork'
  11721. incpath='$incpath'
  11722. inews='$inews'
  11723. installarchlib='$installarchlib'
  11724. installbin='$installbin'
  11725. installman1dir='$installman1dir'
  11726. installman3dir='$installman3dir'
  11727. installprivlib='$installprivlib'
  11728. installscript='$installscript'
  11729. installsitearch='$installsitearch'
  11730. installsitelib='$installsitelib'
  11731. intsize='$intsize'
  11732. known_extensions='$known_extensions'
  11733. ksh='$ksh'
  11734. large='$large'
  11735. ld='$ld'
  11736. lddlflags='$lddlflags'
  11737. ldflags='$ldflags'
  11738. less='$less'
  11739. lib_ext='$lib_ext'
  11740. libc='$libc'
  11741. libperl='$libperl'
  11742. libpth='$libpth'
  11743. libs='$libs'
  11744. libswanted='$libswanted'
  11745. line='$line'
  11746. lint='$lint'
  11747. lkflags='$lkflags'
  11748. ln='$ln'
  11749. lns='$lns'
  11750. locincpth='$locincpth'
  11751. loclibpth='$loclibpth'
  11752. longdblsize='$longdblsize'
  11753. longlongsize='$longlongsize'
  11754. longsize='$longsize'
  11755. lp='$lp'
  11756. lpr='$lpr'
  11757. ls='$ls'
  11758. lseektype='$lseektype'
  11759. mail='$mail'
  11760. mailx='$mailx'
  11761. make='$make'
  11762. make_set_make='$make_set_make'
  11763. mallocobj='$mallocobj'
  11764. mallocsrc='$mallocsrc'
  11765. malloctype='$malloctype'
  11766. man1dir='$man1dir'
  11767. man1direxp='$man1direxp'
  11768. man1ext='$man1ext'
  11769. man3dir='$man3dir'
  11770. man3direxp='$man3direxp'
  11771. man3ext='$man3ext'
  11772. medium='$medium'
  11773. mips='$mips'
  11774. mips_type='$mips_type'
  11775. mkdir='$mkdir'
  11776. models='$models'
  11777. modetype='$modetype'
  11778. more='$more'
  11779. mv='$mv'
  11780. myarchname='$myarchname'
  11781. mydomain='$mydomain'
  11782. myhostname='$myhostname'
  11783. myuname='$myuname'
  11784. n='$n'
  11785. netdb_hlen_type='$netdb_hlen_type'
  11786. netdb_host_type='$netdb_host_type'
  11787. netdb_name_type='$netdb_name_type'
  11788. netdb_net_type='$netdb_net_type'
  11789. nm='$nm'
  11790. nm_opt='$nm_opt'
  11791. nm_so_opt='$nm_so_opt'
  11792. nonxs_ext='$nonxs_ext'
  11793. nroff='$nroff'
  11794. o_nonblock='$o_nonblock'
  11795. obj_ext='$obj_ext'
  11796. optimize='$optimize'
  11797. orderlib='$orderlib'
  11798. osname='$osname'
  11799. osvers='$osvers'
  11800. package='$package'
  11801. pager='$pager'
  11802. passcat='$passcat'
  11803. patchlevel='$patchlevel'
  11804. path_sep='$path_sep'
  11805. perl='$perl'
  11806. perladmin='$perladmin'
  11807. perlpath='$perlpath'
  11808. pg='$pg'
  11809. phostname='$phostname'
  11810. pidtype='$pidtype'
  11811. plibpth='$plibpth'
  11812. pmake='$pmake'
  11813. pr='$pr'
  11814. prefix='$prefix'
  11815. prefixexp='$prefixexp'
  11816. privlib='$privlib'
  11817. privlibexp='$privlibexp'
  11818. prototype='$prototype'
  11819. ptrsize='$ptrsize'
  11820. randbits='$randbits'
  11821. ranlib='$ranlib'
  11822. rd_nodata='$rd_nodata'
  11823. rm='$rm'
  11824. rmail='$rmail'
  11825. runnm='$runnm'
  11826. scriptdir='$scriptdir'
  11827. scriptdirexp='$scriptdirexp'
  11828. sed='$sed'
  11829. selecttype='$selecttype'
  11830. sendmail='$sendmail'
  11831. sh='$sh'
  11832. shar='$shar'
  11833. sharpbang='$sharpbang'
  11834. shmattype='$shmattype'
  11835. shortsize='$shortsize'
  11836. shrpenv='$shrpenv'
  11837. shsharp='$shsharp'
  11838. sig_name='$sig_name'
  11839. sig_name_init='$sig_name_init'
  11840. sig_num='$sig_num'
  11841. signal_t='$signal_t'
  11842. sitearch='$sitearch'
  11843. sitearchexp='$sitearchexp'
  11844. sitelib='$sitelib'
  11845. sitelibexp='$sitelibexp'
  11846. sizetype='$sizetype'
  11847. sleep='$sleep'
  11848. smail='$smail'
  11849. small='$small'
  11850. so='$so'
  11851. sockethdr='$sockethdr'
  11852. socketlib='$socketlib'
  11853. sort='$sort'
  11854. spackage='$spackage'
  11855. spitshell='$spitshell'
  11856. split='$split'
  11857. src='$src'
  11858. ssizetype='$ssizetype'
  11859. startperl='$startperl'
  11860. startsh='$startsh'
  11861. static_ext='$static_ext'
  11862. stdchar='$stdchar'
  11863. stdio_base='$stdio_base'
  11864. stdio_bufsiz='$stdio_bufsiz'
  11865. stdio_cnt='$stdio_cnt'
  11866. stdio_filbuf='$stdio_filbuf'
  11867. stdio_ptr='$stdio_ptr'
  11868. strings='$strings'
  11869. submit='$submit'
  11870. subversion='$subversion'
  11871. sysman='$sysman'
  11872. tail='$tail'
  11873. tar='$tar'
  11874. tbl='$tbl'
  11875. tee='$tee'
  11876. test='$test'
  11877. timeincl='$timeincl'
  11878. timetype='$timetype'
  11879. touch='$touch'
  11880. tr='$tr'
  11881. trnl='$trnl'
  11882. troff='$troff'
  11883. uidtype='$uidtype'
  11884. uname='$uname'
  11885. uniq='$uniq'
  11886. usedl='$usedl'
  11887. usemymalloc='$usemymalloc'
  11888. usenm='$usenm'
  11889. useopcode='$useopcode'
  11890. useperlio='$useperlio'
  11891. useposix='$useposix'
  11892. usesfio='$usesfio'
  11893. useshrplib='$useshrplib'
  11894. usethreads='$usethreads'
  11895. usevfork='$usevfork'
  11896. usrinc='$usrinc'
  11897. uuname='$uuname'
  11898. version='$version'
  11899. vi='$vi'
  11900. voidflags='$voidflags'
  11901. xlibpth='$xlibpth'
  11902. zcat='$zcat'
  11903. zip='$zip'
  11904. EOT
  11905.  
  11906. : Add in command line options if available
  11907. $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
  11908.  
  11909. : add special variables
  11910. $test -f $src/patchlevel.h && \
  11911. awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
  11912. echo "CONFIG=true" >>config.sh
  11913.  
  11914. : propagate old symbols
  11915. if $test -f UU/config.sh; then
  11916.     <UU/config.sh sort | uniq >UU/oldconfig.sh
  11917.     sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
  11918.     sort | uniq -u >UU/oldsyms
  11919.     set X `cat UU/oldsyms`
  11920.     shift
  11921.     case $# in
  11922.     0) ;;
  11923.     *)
  11924.         cat <<EOM
  11925. Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
  11926. EOM
  11927.         echo "# Variables propagated from previous config.sh file." >>config.sh
  11928.         for sym in `cat UU/oldsyms`; do
  11929.             echo "    Propagating $hint variable "'$'"$sym..."
  11930.             eval 'tmp="$'"${sym}"'"'
  11931.             echo "$tmp" | \
  11932.                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
  11933.         done
  11934.         ;;
  11935.     esac
  11936. fi
  11937.  
  11938. : Finish up by extracting the .SH files
  11939. case "$alldone" in
  11940. exit)
  11941.     $rm -rf UU
  11942.     echo "Done."
  11943.     exit 0
  11944.     ;;
  11945. cont)
  11946.     ;;
  11947. '')
  11948.     dflt=''
  11949.     nostick=true
  11950.     $cat <<EOM
  11951.  
  11952. If you'd like to make any changes to the config.sh file before I begin
  11953. to configure things, do it as a shell escape now (e.g. !vi config.sh).
  11954.  
  11955. EOM
  11956.     rp="Press return or use a shell escape to edit config.sh:"
  11957.     . UU/myread
  11958.     nostick=''
  11959.     case "$ans" in
  11960.     '') ;;
  11961.     *) : in case they cannot read
  11962.         sh 1>&4 -c "$ans";;
  11963.     esac
  11964.     ;;
  11965. esac
  11966.  
  11967. : if this fails, just run all the .SH files by hand
  11968. . ./config.sh
  11969.  
  11970. case "$ebcdic" in
  11971. $define)
  11972.     xxx=''
  11973.     echo "This is an EBCDIC system, checking if any parser files may need regenerating." >&4
  11974.     rm -f y.tab.c y.tab.h
  11975.     yacc -d perly.y >/dev/null 2>&1
  11976.     if cmp -s y.tab.c perly.c; then
  11977.         rm -f y.tab.c
  11978.     else
  11979.         echo "perly.y -> perly.c" >&4
  11980.         mv -f y.tab.c perly.c
  11981.         chmod u+w perly.c
  11982.         sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
  11983.             -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
  11984.         xxx="$xxx perly.c"
  11985.     fi
  11986.     if cmp -s y.tab.h perly.h; then
  11987.         rm -f y.tab.h
  11988.     else
  11989.         echo "perly.y -> perly.h" >&4
  11990.         mv -f y.tab.h perly.h
  11991.         xxx="$xxx perly.h"
  11992.     fi
  11993.     echo "x2p/a2p.y" >&4
  11994.     cd x2p
  11995.     rm -f y.tab.c y.tab.h
  11996.     yacc -d a2p.y >/dev/null 2>&1
  11997.     if cmp -s y.tab.c a2p.c
  11998.     then
  11999.         rm -f y.tab.c
  12000.     else
  12001.         echo "a2p.y -> a2p.c" >&4
  12002.         mv -f y.tab.c a2p.c
  12003.         chmod u+w a2p.c
  12004.         sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
  12005.             -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
  12006.         xxx="$xxx a2p.c"
  12007.     fi
  12008.     if cmp -s y.tab.h a2p.h
  12009.     then
  12010.         rm -f y.tab.h
  12011.     else
  12012.         echo "a2p.h -> a2p.h" >&4
  12013.         mv -f y.tab.h a2p.h
  12014.         xxx="$xxx a2p.h"
  12015.     fi
  12016.     cd ..
  12017.     case "$xxx" in
  12018.     '') echo "No parser files were regenerated.  That's okay." >&4 ;;
  12019.     esac
  12020.     ;;
  12021. esac
  12022.  
  12023. echo " "
  12024. exec 1>&4
  12025. . ./UU/extract
  12026.  
  12027. if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
  12028.     dflt=y
  12029.     case "$silent" in
  12030.     true) ;;
  12031.     *)
  12032.         $cat <<EOM
  12033.  
  12034. Now you need to generate make dependencies by running "make depend".
  12035. You might prefer to run it in background: "make depend > makedepend.out &"
  12036. It can take a while, so you might not want to run it right now.
  12037.  
  12038. EOM
  12039.         ;;
  12040.     esac
  12041.     rp="Run make depend now?"
  12042.     . UU/myread
  12043.     case "$ans" in
  12044.     y*)
  12045.         make depend && echo "Now you must run a make."
  12046.         ;;
  12047.     *)
  12048.         echo "You must run 'make depend' then 'make'."
  12049.         ;;
  12050.     esac
  12051. elif test -f [Mm]akefile; then
  12052.     echo " "
  12053.     echo "Now you must run a make."
  12054. else
  12055.     echo "Done."
  12056. fi
  12057.  
  12058. if $test -f Policy.sh; then
  12059.     $cat <<EOM
  12060.  
  12061. If you compile $package on a different machine or from a different object
  12062. directory, copy the Policy.sh file from this object directory to the
  12063. new one before you run Configure -- this will help you with most of
  12064. the policy defaults.
  12065.  
  12066. EOM
  12067. fi
  12068. if $test -f config.msg; then
  12069.     echo "Hmm.  I also noted the following information while running:"
  12070.     echo " "
  12071.     $cat config.msg >&4
  12072.     $rm -f config.msg
  12073. fi
  12074. $rm -f kit*isdone ark*isdone
  12075. $rm -rf UU
  12076.  
  12077. : End of Configure
  12078.  
  12079.